hurl/integration/tests_failed/assert_status.html
jcamiel 6b7753e174
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.
2022-12-10 14:44:23 +01:00

17 lines
1.7 KiB
HTML

<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">&lt;</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>