Skip to content

Commit

Permalink
Add failed test in HTML/JUnit/TAP reports
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamiel committed Oct 27, 2023
1 parent fb37316 commit 9f4cae5
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 5 deletions.
3 changes: 3 additions & 0 deletions integration/tests_ok/html.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'

# Some tests are failing but we want to continue until the end
$ErrorActionPreference = "Continue"
hurl --test `
--report-html build\tmp\ `
--glob "tests_ok\test.*.hurl"
Expand Down Expand Up @@ -100,3 +102,4 @@ hurl --test `
tests_failed\retry_option.hurl `
tests_failed\template_variable_not_found.hurl `
tests_failed\template_variable_not_renderable.hurl
$ErrorActionPreference = 'Stop'
3 changes: 3 additions & 0 deletions integration/tests_ok/html.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -Eeuo pipefail

# Some tests are failing but we want to continue until the end
set +euo pipefail
hurl --test \
--report-html build/ \
--glob "tests_ok/test.*.hurl"
Expand Down Expand Up @@ -101,3 +103,4 @@ hurl --test \
tests_failed/retry_option.hurl \
tests_failed/template_variable_not_found.hurl \
tests_failed/template_variable_not_renderable.hurl
set -Eeuo pipefail
5 changes: 5 additions & 0 deletions integration/tests_ok/junit.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
set -Eeuo pipefail
rm -f build/result.xml

# test.2.hurl is KO but we don't the script ton continue until the end
set +eo pipefail
hurl --test --report-junit build/result.xml tests_ok/test.1.hurl tests_ok/test.2.hurl
hurl --test --report-junit build/result.xml tests_ok/test.3.hurl
set -Eeuo pipefail

cat build/result.xml
1 change: 1 addition & 0 deletions integration/tests_ok/tap.exit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
2 changes: 1 addition & 1 deletion integration/tests_ok/tap.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TAP version 13
1..3
ok 1 - tests_ok/test.1.hurl
ok 2 - tests_ok/test.2.hurl
not ok 2 - tests_ok/test.2.hurl
ok 3 - tests_ok/test.3.hurl
5 changes: 5 additions & 0 deletions integration/tests_ok/tap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ $ErrorActionPreference = 'Stop'
if (Test-Path build/result.tap) {
Remove-Item build/result.tap
}

# test.2.hurl is KO but we don't the script ton continue until the end
$ErrorActionPreference = 'Continue'
hurl --test --report-tap build/result.tap tests_ok/test.1.hurl tests_ok/test.2.hurl
hurl --test --report-tap build/result.tap tests_ok/test.3.hurl
$ErrorActionPreference = 'Stop'

Write-Host (Get-Content build/result.tap -Raw) -NoNewLine
5 changes: 5 additions & 0 deletions integration/tests_ok/tap.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
set -Eeuo pipefail
rm -f build/result.tap

# test.2.hurl is KO but we don't the script ton continue until the end
set +eo pipefail
hurl --test --report-tap build/result.tap tests_ok/test.1.hurl tests_ok/test.2.hurl
hurl --test --report-tap build/result.tap tests_ok/test.3.hurl
set -Eeuo pipefail

cat build/result.tap
8 changes: 6 additions & 2 deletions integration/tests_ok/test.2.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<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/hello</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><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
<span class="line"><span class="string">`Hello World!`</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/hello</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">`Goodbye World!`</span></span>
</span></span></code></pre>
6 changes: 5 additions & 1 deletion integration/tests_ok/test.2.hurl
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
GET http://localhost:8000/hello

HTTP 200
`Hello World!`


GET http://localhost:8000/hello
HTTP 200
`Goodbye World!`
2 changes: 1 addition & 1 deletion integration/tests_ok/test.2.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}}]}
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"type":"text","value":"Hello World!"}}},{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"status":200,"body":{"type":"text","value":"Goodbye World!"}}}]}

0 comments on commit 9f4cae5

Please sign in to comment.