Skip to content

Commit

Permalink
Add integration tests for --error-format long.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamiel committed May 25, 2023
1 parent fa57384 commit 22fd7a2
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 2 deletions.
33 changes: 33 additions & 0 deletions integration/tests_failed/error_format_long.err.pattern
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HTTP/1.1 200
Server: Werkzeug/~~~ Python/~~
Date: ~~~
Content-Type: text/html; charset=utf-8
Content-Length: 45
Server: Flask Server
Connection: close

<html><head><title>Test</title></head></html>

error: Assert header value
--> tests_failed/error_format_long.hurl:3:15
|
3 | Content-Type: text/html
| ^^^^^^^^^ actual value is <text/html; charset=utf-8>
|

error: Assert failure
--> tests_failed/error_format_long.hurl:5:0
|
5 | xpath "string(//head/title)" equals "Welcome!"
| actual: string <Test>
| expected: string <Welcome!>
|

error: Assert failure
--> tests_failed/error_format_long.hurl:7:0
|
7 | xpath "//title" count == 2
| actual: int <1>
| expected: int <2>
|

1 change: 1 addition & 0 deletions integration/tests_failed/error_format_long.exit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
8 changes: 8 additions & 0 deletions integration/tests_failed/error_format_long.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<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/error-assert-xpath</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
<span class="line"><span class="string">Content-Type</span>: <span class="string">text/html</span></span>
<span class="line"><span class="section-header">[Asserts]</span></span>
<span class="line"><span class="query-type">xpath</span> <span class="string">"string(//head/title)"</span> <span class="predicate-type">equals</span> <span class="string">"Welcome!"</span></span>
<span class="line"><span class="query-type">xpath</span> <span class="string">"//foo"</span> <span class="predicate-type">isEmpty</span></span>
<span class="line"><span class="query-type">xpath</span> <span class="string">"//title"</span> <span class="filter-type">count</span> <span class="predicate-type">==</span> <span class="number">2</span></span>
</span></span></code></pre>
7 changes: 7 additions & 0 deletions integration/tests_failed/error_format_long.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
GET http://localhost:8000/error-assert-xpath
HTTP 200
Content-Type: text/html
[Asserts]
xpath "string(//head/title)" equals "Welcome!"
xpath "//foo" isEmpty
xpath "//title" count == 2
1 change: 1 addition & 0 deletions integration/tests_failed/error_format_long.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-xpath"},"response":{"status":200,"headers":[{"name":"Content-Type","value":"text/html"}],"asserts":[{"query":{"type":"xpath","expr":"string(//head/title)"},"predicate":{"type":"equal","value":"Welcome!"}},{"query":{"type":"xpath","expr":"//foo"},"predicate":{"type":"isEmpty"}},{"query":{"type":"xpath","expr":"//title"},"filters":[{"type":"count"}],"predicate":{"type":"equal","value":2}}]}}]}
3 changes: 3 additions & 0 deletions integration/tests_failed/error_format_long.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
hurl --error-format long tests_failed/error_format_long.hurl
3 changes: 3 additions & 0 deletions integration/tests_failed/error_format_long.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -Eeuo pipefail
hurl --error-format long tests_failed/error_format_long.hurl
2 changes: 1 addition & 1 deletion integration/tests_failed/option_retry.err.pattern
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
< Connection: close
<
*
*
* Retry max count reached, no more retry
*
error: Assert status code
--> tests_failed/option_retry.hurl:6:6
|
Expand Down
2 changes: 1 addition & 1 deletion integration/tests_failed/retry.err.pattern
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@
< Connection: close
<
*
*
* Retry max count reached, no more retry
*
error: Assert status code
--> tests_failed/retry.hurl:2:6
|
Expand Down

0 comments on commit 22fd7a2

Please sign in to comment.