Add integration tests for --error-format long.

This commit is contained in:
jcamiel 2023-05-25 16:28:10 +02:00
parent e476038440
commit ff9b62faa1
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
9 changed files with 58 additions and 2 deletions

View File

@ -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>
|

View File

@ -0,0 +1 @@
4

View File

@ -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>

View File

@ -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

View File

@ -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}}]}}]}

View File

@ -0,0 +1,3 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
hurl --error-format long tests_failed/error_format_long.hurl

View File

@ -0,0 +1,3 @@
#!/bin/bash
set -Eeuo pipefail
hurl --error-format long tests_failed/error_format_long.hurl

View File

@ -117,8 +117,8 @@
< Connection: close
<
*
*
* Retry max count reached, no more retry
*
error: Assert status code
--> tests_failed/option_retry.hurl:6:6
|

View File

@ -207,8 +207,8 @@
< Connection: close
<
*
*
* Retry max count reached, no more retry
*
error: Assert status code
--> tests_failed/retry.hurl:2:6
|