Skip to content

Commit

Permalink
feat: test workflows - additional junit report cases (#6157)
Browse files Browse the repository at this point in the history
* JUnit report special cases - global failure

* JUnit report special cases - global failure - updated

* JUnit report special cases - global failure - updated

* JUnit report special cases - global failure - updated

* junit examples

* junit examples

* junit workflows

* branch updated
  • Loading branch information
tkonieczny authored Feb 7, 2025
1 parent 0045e41 commit 1a8ad20
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 0 deletions.
69 changes: 69 additions & 0 deletions test/special-cases/test-workflows/junit-reports.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
name: junit-report-high-level-failure
labels:
core-tests: special-cases
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/special-cases/test-workflows/junit-reports/high-level-failure.xml
container:
workingDir: /data/repo/test/special-cases/test-workflows/junit-reports
image: alpine:3.21.2
steps:
- name: Step
shell: echo "Step"
artifacts:
paths:
- /data/repo/test/special-cases/test-workflows/junit-reports/*
---
kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
name: junit-report-high-level-without-testcases
labels:
core-tests: special-cases
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/special-cases/test-workflows/junit-reports/high-level-without-testcases.xml
container:
workingDir: /data/repo/test/special-cases/test-workflows/junit-reports
image: alpine:3.21.2
steps:
- name: Step
shell: echo "Step"
artifacts:
paths:
- /data/repo/test/special-cases/test-workflows/junit-reports/*
---
kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
name: junit-report-high-level-testcase-both-error-and-failure
labels:
core-tests: special-cases
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/special-cases/test-workflows/junit-reports/high-level-testcase-both-error-and-failure.xml
container:
workingDir: /data/repo/test/special-cases/test-workflows/junit-reports
image: alpine:3.21.2
steps:
- name: Step
shell: echo "Step"
artifacts:
paths:
- /data/repo/test/special-cases/test-workflows/junit-reports/*

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<testsuites tests="11" failures="1" errors="2" skipped="1" time="225.157">
<testsuite name="AAA" timestamp="2025-02-05T12:53:03" time="8.887" tests="6" failures="0" errors="0" skipped="0">

<!-- All test cases passed -->
<testcase name="testSuccess1" classname="com.example.AAATests" time="1.500"/>
<testcase name="testSuccess2" classname="com.example.AAATests" time="1.200"/>
<testcase name="testSuccess3" classname="com.example.AAATests" time="1.800"/>
<testcase name="testSuccess4" classname="com.example.AAATests" time="1.000"/>
<testcase name="testSuccess5" classname="com.example.AAATests" time="1.250"/>
<testcase name="testSuccess6" classname="com.example.AAATests" time="2.137"/>

</testsuite>

<testsuite name="BBB" timestamp="2025-02-05T12:53:02" time="14.071" tests="5" failures="1" errors="2" skipped="1">

<!-- A successful test case -->
<testcase name="testSuccess1" classname="com.example.BBBTests" time="3.500"/>

<!-- Another successful test case -->
<testcase name="testSuccess2" classname="com.example.BBBTests" time="2.000"/>

<!-- A failed test case -->
<testcase name="testFailure" classname="com.example.BBBTests" time="4.200">
<failure message="Expected value X but got Y" type="AssertionError">
<![CDATA[
junit.framework.AssertionFailedError: Expected X but got Y
at com.example.BBBTests.testFailure(BBBTests.java:42)
]]>
</failure>
</testcase>

<!-- A test case with an error (exception) -->
<testcase name="testError1" classname="com.example.BBBTests" time="2.371">
<error message="NullPointerException occurred" type="java.lang.NullPointerException">
<![CDATA[
java.lang.NullPointerException
at com.example.BBBTests.testError1(BBBTests.java:55)
]]>
</error>
</testcase>

<!-- Another test case with an error (runtime exception) -->
<testcase name="testError2" classname="com.example.BBBTests" time="3.000">
<error message="ArrayIndexOutOfBoundsException occurred" type="java.lang.ArrayIndexOutOfBoundsException">
<![CDATA[
java.lang.ArrayIndexOutOfBoundsException: Index 10 out of bounds for length 5
at com.example.BBBTests.testError2(BBBTests.java:65)
]]>
</error>
</testcase>

<!-- A skipped test case -->
<testcase name="testSkipped" classname="com.example.BBBTests" time="0.000">
<skipped message="Test skipped due to unmet precondition"/>
</testcase>
</testsuite>
</testsuites>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<testsuites tests="8" failures="2" errors="2" skipped="0" time="225.157">
<testsuite name="AAA" timestamp="2025-02-05T12:53:03" time="8.887" tests="6" failures="0" errors="0" skipped="0">

<!-- All test cases passed -->
<testcase name="testSuccess1" classname="com.example.AAATests" time="1.500"/>
<testcase name="testSuccess2" classname="com.example.AAATests" time="1.200"/>
<testcase name="testSuccess3" classname="com.example.AAATests" time="1.800"/>
<testcase name="testSuccess4" classname="com.example.AAATests" time="1.000"/>
<testcase name="testSuccess5" classname="com.example.AAATests" time="1.250"/>
<testcase name="testSuccess6" classname="com.example.AAATests" time="2.137"/>

</testsuite>

<testsuite name="BBB" timestamp="2025-02-05T12:53:02" time="14.071" tests="2" failures="2" errors="2" skipped="0">

<!-- Incorrect - both failure and error -->
<testcase classname="exampleClassname" name="Example Name 1" time="10.037">
<failure/>
<error message="element click intercepted: Elementis not clickable at point (192, 687). Other element would receive the click (Session info: chrome=110.0.5481.100)"/>
</testcase>

<!-- Incorrect - both failure and error -->
<testcase classname="exampleClassname" name="Example Name 2" time="19.256">
<failure/>
<error message="element click intercepted: Elementis not clickable at point (128, 128). Other element would receive the click (Session info: chrome=110.0.5481.100)"/>
</testcase>
</testsuite>
</testsuites>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<testsuites tests="24" failures="4" errors="5" skipped="3" time="225.157">
<testsuite name="AAA" timestamp="2025-02-05T12:53:03" time="8.887" tests="6" failures="0" errors="0" skipped="0">
</testsuite>
<testsuite name="BBB" timestamp="2025-02-05T12:53:02" time="14.071" tests="12" failures="4" errors="5" skipped="3">
</testsuite>
<testsuite name="CCC" timestamp="2025-02-05T12:53:43" time="22.115" tests="6" failures="0" errors="0" skipped="0">
<properties>
<property name="specId" value="0"/>
<property name="suiteName" value="ASDF"/>
<property name="capabilities" value="browser-ASDF"/>
<property name="file" value="./tests/some-test-file"/>
</properties>
<testcase classname="example-classname" name="Example name" time="17.295">
<system-out>
Example system-out
</system-out>
</testcase>
</testsuite>
</testsuites>

0 comments on commit 1a8ad20

Please sign in to comment.