-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check HTTP version and status first, then other asserts.
If HTTP version or status are not correct, we fail the test without running others asserts.
- Loading branch information
Showing
8 changed files
with
123 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
error: Assert status code | ||
--> tests_failed/assert_status.hurl:2:6 | ||
--> tests_failed/assert_status.hurl:9:6 | ||
| | ||
2 | HTTP 200 | ||
9 | HTTP 200 | ||
| ^^^ actual value is <404> | ||
| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/not_found</span></span> | ||
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span> | ||
</span></span><span class="line"></span> | ||
</code></pre> | ||
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"></span><span class="comment"># We add various explicit asserts on the body, and</span> | ||
<span class="line"></span><span class="comment"># implicit asserts on the response headers.</span> | ||
<span class="line"></span><span class="comment"># As the status code is not correct, those asserts</span> | ||
<span class="line"></span><span class="comment"># should not be tested (the status code is a "stronger"</span> | ||
<span class="line"></span><span class="comment"># assert than the others).</span> | ||
<span class="line"></span> | ||
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/not_found</span></span> | ||
</span><span class="response"><span class="line"></span> | ||
<span class="line"><span class="version">HTTP</span> <span class="number">200</span></span> | ||
<span class="line"><span class="string">x-baz</span><span>:</span> <span class="string">xxx</span></span> | ||
<span class="line section-header">[Asserts]</span> | ||
<span class="line"><span class="query-type">duration</span> <span class="predicate-type"><</span> <span class="number">0</span></span> | ||
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.foo"</span> <span class="predicate-type">startsWith</span> <span class="string">"something"</span></span> | ||
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.bar"</span> <span class="not">not</span> <span class="predicate-type">exists</span></span> | ||
<span class="line"><span class="query-type">header</span> <span class="string">"x-bar"</span> <span class="predicate-type">exists</span></span> | ||
</span></span></code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
# We add various explicit asserts on the body, and | ||
# implicit asserts on the response headers. | ||
# As the status code is not correct, those asserts | ||
# should not be tested (the status code is a "stronger" | ||
# assert than the others). | ||
|
||
GET http://localhost:8000/not_found | ||
HTTP 200 | ||
|
||
HTTP 200 | ||
x-baz: xxx | ||
[Asserts] | ||
duration < 0 | ||
jsonpath "$.foo" startsWith "something" | ||
jsonpath "$.bar" not exists | ||
header "x-bar" exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/not_found"},"response":{"status":200}}]} | ||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/not_found"},"response":{"status":200,"headers":[{"name":"x-baz","value":"xxx"}],"asserts":[{"query":{"type":"duration"},"predicate":{"type":"less","value":0}},{"query":{"type":"jsonpath","expr":"$.foo"},"predicate":{"type":"start-with","value":"something"}},{"query":{"type":"jsonpath","expr":"$.bar"},"predicate":{"not":true,"type":"exist"}},{"query":{"type":"header","name":"x-bar"},"predicate":{"type":"exist"}}]}}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"cookies":[],"entries":[{"asserts":[{"line":2,"success":true},{"line":2,"message":"Assert status code\n --> tests_failed/assert_status.hurl:2:6\n |\n 2 | HTTP 200\n | ^^^ actual value is <404>\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/not_found"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"232"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":404}}],"captures":[],"index":1,"time":~~~}],"filename":"tests_failed/assert_status.hurl","success":false,"time":~~~} | ||
{"cookies":[],"entries":[{"asserts":[{"line":9,"success":true},{"line":9,"message":"Assert status code\n --> tests_failed/assert_status.hurl:9:6\n |\n 9 | HTTP 200\n | ^^^ actual value is <404>\n |","success":false}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8000"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"http://localhost:8000/not_found"},"response":{"cookies":[],"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"232"},{"name":"Server","value":"Flask Server"},{"name":"Date","value":"~~~"}],"httpVersion":"HTTP/1.0","status":404}}],"captures":[],"index":1,"time":~~~}],"filename":"tests_failed/assert_status.hurl","success":false,"time":~~~} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters