mirror of
https://github.com/dorny/test-reporter.git
synced 2026-02-01 19:05:23 -08:00
Compare commits
15 Commits
fix/add-go
...
feature/ju
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f24c625f56 | ||
|
|
ee446707ff | ||
|
|
fe45e95373 | ||
|
|
e40a1da745 | ||
|
|
3445860437 | ||
|
|
9ef5c136b2 | ||
|
|
83e20c1534 | ||
|
|
4331a3b620 | ||
|
|
04232af26f | ||
|
|
cf146f4036 | ||
|
|
33fc27cf09 | ||
|
|
fc80cb4400 | ||
|
|
79ea6a9d0e | ||
|
|
aef3d726a6 | ||
|
|
c1a56edcfe |
2
.github/workflows/check-dist.yml
vendored
2
.github/workflows/check-dist.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set Node.js
|
||||
uses: actions/setup-node@v6
|
||||
|
||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
name: Build & Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
|
||||
2
.github/workflows/manual-run.yml
vendored
2
.github/workflows/manual-run.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
|
||||
2
.github/workflows/test-report.yml
vendored
2
.github/workflows/test-report.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
name: Workflow test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./
|
||||
with:
|
||||
artifact: test-results
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 2.3.0
|
||||
* Feature: Add Python support with `python-xunit` reporter (pytest) https://github.com/dorny/test-reporter/pull/643
|
||||
* Feature: Add pytest traceback parsing and `directory-mapping` option https://github.com/dorny/test-reporter/pull/238
|
||||
* Performance: Update sax.js to fix large XML file parsing https://github.com/dorny/test-reporter/pull/681
|
||||
* Documentation: Complete documentation for all supported reporters https://github.com/dorny/test-reporter/pull/691
|
||||
* Security: Bump js-yaml and mocha in /reports/mocha (fixes prototype pollution) https://github.com/dorny/test-reporter/pull/682
|
||||
|
||||
## 2.2.0
|
||||
* Feature: Add collapsed option to control report summary visibility https://github.com/dorny/test-reporter/pull/664
|
||||
* Fix badge encoding for values including underscore and hyphens https://github.com/dorny/test-reporter/pull/672
|
||||
|
||||
44
README.md
44
README.md
@@ -20,6 +20,7 @@ This [Github Action](https://github.com/features/actions) displays test results
|
||||
- Java / [JUnit](https://junit.org/)
|
||||
- JavaScript / [JEST](https://jestjs.io/) / [Mocha](https://mochajs.org/)
|
||||
- Python / [pytest](https://docs.pytest.org/en/stable/) / [unittest](https://docs.python.org/3/library/unittest.html)
|
||||
- Ruby / [RSpec](https://rspec.info/)
|
||||
- Swift / xUnit
|
||||
|
||||
For more information see [Supported formats](#supported-formats) section.
|
||||
@@ -256,6 +257,20 @@ Supported testing frameworks:
|
||||
For more information see [dotnet test](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#examples)
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>dotnet-nunit</summary>
|
||||
|
||||
Test execution must be configured to generate [NUnit3](https://docs.nunit.org/articles/nunit/technical-notes/usage/Test-Result-XML-Format.html) XML test results.
|
||||
Install the [NUnit3TestAdapter](https://www.nuget.org/packages/NUnit3TestAdapter) package (required; it registers the `nunit` logger for `dotnet test`), then run tests with:
|
||||
|
||||
`dotnet test --logger "nunit;LogFileName=test-results.xml"`
|
||||
|
||||
Supported testing frameworks:
|
||||
- [NUnit](https://nunit.org/)
|
||||
|
||||
For more information see [dotnet test](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#examples)
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>flutter-json</summary>
|
||||
|
||||
@@ -357,9 +372,34 @@ Please update Mocha to version [v9.1.0](https://github.com/mochajs/mocha/release
|
||||
|
||||
Support for Python test results in xUnit format is experimental - should work but it was not extensively tested.
|
||||
|
||||
For pytest support, configure [JUnit XML output](https://docs.pytest.org/en/stable/how-to/output.html#creating-junitxml-format-files) and run with the `--junit-xml` option, which also lets you specify the output path for test results.
|
||||
For **pytest** support, configure [JUnit XML output](https://docs.pytest.org/en/stable/how-to/output.html#creating-junitxml-format-files) and run with the `--junit-xml` option, which also lets you specify the output path for test results.
|
||||
|
||||
For unittest support, use a test runner that outputs the JUnit report format, such as [unittest-xml-reporting](https://pypi.org/project/unittest-xml-reporting/).
|
||||
```shell
|
||||
pytest --junit-xml=test-report.xml
|
||||
```
|
||||
|
||||
For **unittest** support, use a test runner that outputs the JUnit report format, such as [unittest-xml-reporting](https://pypi.org/project/unittest-xml-reporting/).
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>rspec-json</summary>
|
||||
|
||||
[RSpec](https://rspec.info/) testing framework support requires the usage of JSON formatter.
|
||||
You can configure RSpec to output JSON format by using the `--format json` option and redirecting to a file:
|
||||
|
||||
```shell
|
||||
rspec --format json --out rspec-results.json
|
||||
```
|
||||
|
||||
Or configure it in `.rspec` file:
|
||||
```
|
||||
--format json
|
||||
--out rspec-results.json
|
||||
```
|
||||
|
||||
For more information see:
|
||||
- [RSpec documentation](https://rspec.info/)
|
||||
- [RSpec Formatters](https://relishapp.com/rspec/rspec-core/docs/formatters)
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
23
__tests__/__outputs__/junit-basic.md
Normal file
23
__tests__/__outputs__/junit-basic.md
Normal file
@@ -0,0 +1,23 @@
|
||||

|
||||
|Report|Passed|Failed|Skipped|Time|
|
||||
|:---|---:|---:|---:|---:|
|
||||
|[fixtures/external/java/junit4-basic.xml](#user-content-r0)|5 ✅|1 ❌||16s|
|
||||
## ❌ <a id="user-content-r0" href="#user-content-r0">fixtures/external/java/junit4-basic.xml</a>
|
||||
**6** tests were completed in **16s** with **5** passed, **1** failed and **0** skipped.
|
||||
|Test suite|Passed|Failed|Skipped|Time|
|
||||
|:---|---:|---:|---:|---:|
|
||||
|[Tests.Authentication](#user-content-r0s0)|2 ✅|1 ❌||9s|
|
||||
|[Tests.Registration](#user-content-r0s1)|3 ✅|||7s|
|
||||
### ❌ <a id="user-content-r0s0" href="#user-content-r0s0">Tests.Authentication</a>
|
||||
```
|
||||
✅ testCase7
|
||||
✅ testCase8
|
||||
❌ testCase9
|
||||
AssertionError: Assertion error message
|
||||
```
|
||||
### ✅ <a id="user-content-r0s1" href="#user-content-r0s1">Tests.Registration</a>
|
||||
```
|
||||
✅ testCase1
|
||||
✅ testCase2
|
||||
✅ testCase3
|
||||
```
|
||||
22
__tests__/__outputs__/junit-complete.md
Normal file
22
__tests__/__outputs__/junit-complete.md
Normal file
@@ -0,0 +1,22 @@
|
||||

|
||||
|Report|Passed|Failed|Skipped|Time|
|
||||
|:---|---:|---:|---:|---:|
|
||||
|[fixtures/external/java/junit4-complete.xml](#user-content-r0)|5 ✅|2 ❌|1 ⚪|16s|
|
||||
## ❌ <a id="user-content-r0" href="#user-content-r0">fixtures/external/java/junit4-complete.xml</a>
|
||||
**8** tests were completed in **16s** with **5** passed, **2** failed and **1** skipped.
|
||||
|Test suite|Passed|Failed|Skipped|Time|
|
||||
|:---|---:|---:|---:|---:|
|
||||
|[Tests.Registration](#user-content-r0s0)|5 ✅|2 ❌|1 ⚪|16s|
|
||||
### ❌ <a id="user-content-r0s0" href="#user-content-r0s0">Tests.Registration</a>
|
||||
```
|
||||
✅ testCase1
|
||||
✅ testCase2
|
||||
✅ testCase3
|
||||
⚪ testCase4
|
||||
❌ testCase5
|
||||
AssertionError: Expected value did not match.
|
||||
❌ testCase6
|
||||
ArithmeticError: Division by zero.
|
||||
✅ testCase7
|
||||
✅ testCase8
|
||||
```
|
||||
26
__tests__/__outputs__/python-xunit-pytest.md
Normal file
26
__tests__/__outputs__/python-xunit-pytest.md
Normal file
@@ -0,0 +1,26 @@
|
||||

|
||||
|Report|Passed|Failed|Skipped|Time|
|
||||
|:---|---:|---:|---:|---:|
|
||||
|[fixtures/python-xunit-pytest.xml](#user-content-r0)|6 ✅|2 ❌|2 ⚪|19ms|
|
||||
## ❌ <a id="user-content-r0" href="#user-content-r0">fixtures/python-xunit-pytest.xml</a>
|
||||
**10** tests were completed in **19ms** with **6** passed, **2** failed and **2** skipped.
|
||||
|Test suite|Passed|Failed|Skipped|Time|
|
||||
|:---|---:|---:|---:|---:|
|
||||
|[pytest](#user-content-r0s0)|6 ✅|2 ❌|2 ⚪|19ms|
|
||||
### ❌ <a id="user-content-r0s0" href="#user-content-r0s0">pytest</a>
|
||||
```
|
||||
tests.test_lib
|
||||
✅ test_always_pass
|
||||
✅ test_with_subtests
|
||||
✅ test_parameterized[param1]
|
||||
✅ test_parameterized[param2]
|
||||
⚪ test_always_skip
|
||||
❌ test_always_fail
|
||||
assert False
|
||||
⚪ test_expected_failure
|
||||
❌ test_error
|
||||
Exception: error
|
||||
✅ test_with_record_property
|
||||
custom_classname
|
||||
✅ test_with_record_xml_attribute
|
||||
```
|
||||
@@ -6878,3 +6878,153 @@ at java.lang.Thread.run(Thread.java:748)
|
||||
"totalTime": 2126531.0000000005,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`java-junit tests report from testmo/junitxml basic example matches snapshot 1`] = `
|
||||
TestRunResult {
|
||||
"path": "fixtures/external/java/junit4-basic.xml",
|
||||
"suites": [
|
||||
TestSuiteResult {
|
||||
"groups": [
|
||||
TestGroupResult {
|
||||
"name": "",
|
||||
"tests": [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase1",
|
||||
"result": "success",
|
||||
"time": 2113.871,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase2",
|
||||
"result": "success",
|
||||
"time": 1051,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase3",
|
||||
"result": "success",
|
||||
"time": 3441,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "Tests.Registration",
|
||||
"totalTime": 6605.870999999999,
|
||||
},
|
||||
TestSuiteResult {
|
||||
"groups": [
|
||||
TestGroupResult {
|
||||
"name": "",
|
||||
"tests": [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase7",
|
||||
"result": "success",
|
||||
"time": 2508,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase8",
|
||||
"result": "success",
|
||||
"time": 1230.8159999999998,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": undefined,
|
||||
"line": undefined,
|
||||
"message": "AssertionError: Assertion error message",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "testCase9",
|
||||
"result": "failed",
|
||||
"time": 982,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "Tests.Authentication",
|
||||
"totalTime": 9076.816,
|
||||
},
|
||||
],
|
||||
"totalTime": 15682.687,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`java-junit tests report from testmo/junitxml complete example matches snapshot 1`] = `
|
||||
TestRunResult {
|
||||
"path": "fixtures/external/java/junit4-complete.xml",
|
||||
"suites": [
|
||||
TestSuiteResult {
|
||||
"groups": [
|
||||
TestGroupResult {
|
||||
"name": "",
|
||||
"tests": [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase1",
|
||||
"result": "success",
|
||||
"time": 2436,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase2",
|
||||
"result": "success",
|
||||
"time": 1534,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase3",
|
||||
"result": "success",
|
||||
"time": 822,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase4",
|
||||
"result": "skipped",
|
||||
"time": 0,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": undefined,
|
||||
"line": undefined,
|
||||
"message": "AssertionError: Expected value did not match.",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "testCase5",
|
||||
"result": "failed",
|
||||
"time": 2902.412,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": undefined,
|
||||
"line": undefined,
|
||||
"message": "ArithmeticError: Division by zero.",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "testCase6",
|
||||
"result": "failed",
|
||||
"time": 3819,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase7",
|
||||
"result": "success",
|
||||
"time": 2944,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "testCase8",
|
||||
"result": "success",
|
||||
"time": 1625.275,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "Tests.Registration",
|
||||
"totalTime": 16082.687,
|
||||
},
|
||||
],
|
||||
"totalTime": 16082.687,
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -1,5 +1,110 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`python-xunit pytest report report from python test results matches snapshot 1`] = `
|
||||
TestRunResult {
|
||||
"path": "fixtures/python-xunit-pytest.xml",
|
||||
"suites": [
|
||||
TestSuiteResult {
|
||||
"groups": [
|
||||
TestGroupResult {
|
||||
"name": "tests.test_lib",
|
||||
"tests": [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "test_always_pass",
|
||||
"result": "success",
|
||||
"time": 2,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "test_with_subtests",
|
||||
"result": "success",
|
||||
"time": 5,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "test_parameterized[param1]",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "test_parameterized[param2]",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "test_always_skip",
|
||||
"result": "skipped",
|
||||
"time": 0,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": "def test_always_fail():
|
||||
> assert False
|
||||
E assert False
|
||||
|
||||
tests/test_lib.py:25: AssertionError
|
||||
",
|
||||
"line": undefined,
|
||||
"message": "assert False",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "test_always_fail",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "test_expected_failure",
|
||||
"result": "skipped",
|
||||
"time": 0,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": "def test_error():
|
||||
> raise Exception("error")
|
||||
E Exception: error
|
||||
|
||||
tests/test_lib.py:32: Exception
|
||||
",
|
||||
"line": undefined,
|
||||
"message": "Exception: error",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "test_error",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "test_with_record_property",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "custom_classname",
|
||||
"tests": [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "test_with_record_xml_attribute",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "pytest",
|
||||
"totalTime": 19,
|
||||
},
|
||||
],
|
||||
"totalTime": undefined,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`python-xunit unittest report report from python test results matches snapshot 1`] = `
|
||||
TestRunResult {
|
||||
"path": "fixtures/python-xunit-unittest.xml",
|
||||
|
||||
31
__tests__/fixtures/external/java/junit4-basic.xml
vendored
Normal file
31
__tests__/fixtures/external/java/junit4-basic.xml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
This is a basic JUnit-style XML example to highlight the basis structure.
|
||||
|
||||
Example by Testmo. Copyright 2023 Testmo GmbH. All rights reserved.
|
||||
Testmo test management software - https://www.testmo.com/
|
||||
-->
|
||||
<testsuites time="15.682687">
|
||||
<testsuite name="Tests.Registration" time="6.605871">
|
||||
<testcase name="testCase1" classname="Tests.Registration" time="2.113871" />
|
||||
<testcase name="testCase2" classname="Tests.Registration" time="1.051" />
|
||||
<testcase name="testCase3" classname="Tests.Registration" time="3.441" />
|
||||
</testsuite>
|
||||
<testsuite name="Tests.Authentication" time="9.076816">
|
||||
<!-- Java JUni4 XML files does not nest <testsuite> elements -->
|
||||
<!--
|
||||
<testsuite name="Tests.Authentication.Login" time="4.356">
|
||||
<testcase name="testCase4" classname="Tests.Authentication.Login" time="2.244" />
|
||||
<testcase name="testCase5" classname="Tests.Authentication.Login" time="0.781" />
|
||||
<testcase name="testCase6" classname="Tests.Authentication.Login" time="1.331" />
|
||||
</testsuite>
|
||||
-->
|
||||
<testcase name="testCase7" classname="Tests.Authentication" time="2.508" />
|
||||
<testcase name="testCase8" classname="Tests.Authentication" time="1.230816" />
|
||||
<testcase name="testCase9" classname="Tests.Authentication" time="0.982">
|
||||
<failure message="Assertion error message" type="AssertionError">
|
||||
<!-- Call stack printed here -->
|
||||
</failure>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
141
__tests__/fixtures/external/java/junit4-complete.xml
vendored
Normal file
141
__tests__/fixtures/external/java/junit4-complete.xml
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
This is a JUnit-style XML example with commonly used tags and attributes.
|
||||
|
||||
Example by Testmo. Copyright 2023 Testmo GmbH. All rights reserved.
|
||||
Testmo test management software - https://www.testmo.com/
|
||||
-->
|
||||
|
||||
<!-- <testsuites> Usually the root element of a JUnit XML file. Some tools leave out
|
||||
the <testsuites> element if there is only a single top-level <testsuite> element (which
|
||||
is then used as the root element).
|
||||
|
||||
name Name of the entire test run
|
||||
tests Total number of tests in this file
|
||||
failures Total number of failed tests in this file
|
||||
errors Total number of errored tests in this file
|
||||
skipped Total number of skipped tests in this file
|
||||
assertions Total number of assertions for all tests in this file
|
||||
time Aggregated time of all tests in this file in seconds
|
||||
timestamp Date and time of when the test run was executed (in ISO 8601 format)
|
||||
-->
|
||||
<testsuites name="Test run" tests="8" failures="1" errors="1" skipped="1"
|
||||
assertions="20" time="16.082687" timestamp="2021-04-02T15:48:23">
|
||||
|
||||
<!-- <testsuite> A test suite usually represents a class, folder or group of tests.
|
||||
There can be many test suites in an XML file, and there can be test suites under other
|
||||
test suites.
|
||||
|
||||
name Name of the test suite (e.g. class name or folder name)
|
||||
tests Total number of tests in this suite
|
||||
failures Total number of failed tests in this suite
|
||||
errors Total number of errored tests in this suite
|
||||
skipped Total number of skipped tests in this suite
|
||||
assertions Total number of assertions for all tests in this suite
|
||||
time Aggregated time of all tests in this file in seconds
|
||||
timestamp Date and time of when the test suite was executed (in ISO 8601 format)
|
||||
file Source code file of this test suite
|
||||
-->
|
||||
<testsuite name="Tests.Registration" tests="8" failures="1" errors="1" skipped="1"
|
||||
assertions="20" time="16.082687" timestamp="2021-04-02T15:48:23"
|
||||
file="tests/registration.code">
|
||||
|
||||
<!-- <properties> Test suites (and test cases, see below) can have additional
|
||||
properties such as environment variables or version numbers. -->
|
||||
<properties>
|
||||
<!-- <property> Each property has a name and value. Some tools also support
|
||||
properties with text values instead of value attributes. -->
|
||||
<property name="version" value="1.774" />
|
||||
<property name="commit" value="ef7bebf" />
|
||||
<property name="browser" value="Google Chrome" />
|
||||
<property name="ci" value="https://github.com/actions/runs/1234" />
|
||||
<property name="config">
|
||||
Config line #1
|
||||
Config line #2
|
||||
Config line #3
|
||||
</property>
|
||||
</properties>
|
||||
|
||||
<!-- <system-out> Optionally data written to standard out for the suite.
|
||||
Also supported on a test case level, see below. -->
|
||||
<system-out>Data written to standard out.</system-out>
|
||||
|
||||
<!-- <system-err> Optionally data written to standard error for the suite.
|
||||
Also supported on a test case level, see below. -->
|
||||
<system-err>Data written to standard error.</system-err>
|
||||
|
||||
<!-- <testcase> There are one or more test cases in a test suite. A test passed
|
||||
if there isn't an additional result element (skipped, failure, error).
|
||||
|
||||
name The name of this test case, often the method name
|
||||
classname The name of the parent class/folder, often the same as the suite's name
|
||||
assertions Number of assertions checked during test case execution
|
||||
time Execution time of the test in seconds
|
||||
file Source code file of this test case
|
||||
line Source code line number of the start of this test case
|
||||
-->
|
||||
<testcase name="testCase1" classname="Tests.Registration" assertions="2"
|
||||
time="2.436" file="tests/registration.code" line="24" />
|
||||
<testcase name="testCase2" classname="Tests.Registration" assertions="6"
|
||||
time="1.534" file="tests/registration.code" line="62" />
|
||||
<testcase name="testCase3" classname="Tests.Registration" assertions="3"
|
||||
time="0.822" file="tests/registration.code" line="102" />
|
||||
|
||||
<!-- Example of a test case that was skipped -->
|
||||
<testcase name="testCase4" classname="Tests.Registration" assertions="0"
|
||||
time="0" file="tests/registration.code" line="164">
|
||||
<!-- <skipped> Indicates that the test was not executed. Can have an optional
|
||||
message describing why the test was skipped. -->
|
||||
<skipped message="Test was skipped." />
|
||||
</testcase>
|
||||
|
||||
<!-- Example of a test case that failed. -->
|
||||
<testcase name="testCase5" classname="Tests.Registration" assertions="2"
|
||||
time="2.902412" file="tests/registration.code" line="202">
|
||||
<!-- <failure> The test failed because one of the assertions/checks failed.
|
||||
Can have a message and failure type, often the assertion type or class. The text
|
||||
content of the element often includes the failure description or stack trace. -->
|
||||
<failure message="Expected value did not match." type="AssertionError">
|
||||
<!-- Failure description or stack trace -->
|
||||
</failure>
|
||||
</testcase>
|
||||
|
||||
<!-- Example of a test case that had errors. -->
|
||||
<testcase name="testCase6" classname="Tests.Registration" assertions="0"
|
||||
time="3.819" file="tests/registration.code" line="235">
|
||||
<!-- <error> The test had an unexpected error during execution. Can have a
|
||||
message and error type, often the exception type or class. The text
|
||||
content of the element often includes the error description or stack trace. -->
|
||||
<error message="Division by zero." type="ArithmeticError">
|
||||
<!-- Error description or stack trace -->
|
||||
</error>
|
||||
</testcase>
|
||||
|
||||
<!-- Example of a test case with outputs. -->
|
||||
<testcase name="testCase7" classname="Tests.Registration" assertions="3"
|
||||
time="2.944" file="tests/registration.code" line="287">
|
||||
<!-- <system-out> Optional data written to standard out for the test case. -->
|
||||
<system-out>Data written to standard out.</system-out>
|
||||
|
||||
<!-- <system-err> Optional data written to standard error for the test case. -->
|
||||
<system-err>Data written to standard error.</system-err>
|
||||
</testcase>
|
||||
|
||||
<!-- Example of a test case with properties -->
|
||||
<testcase name="testCase8" classname="Tests.Registration" assertions="4"
|
||||
time="1.625275" file="tests/registration.code" line="302">
|
||||
<!-- <properties> Some tools also support properties for test cases. -->
|
||||
<properties>
|
||||
<property name="priority" value="high" />
|
||||
<property name="language" value="english" />
|
||||
<property name="author" value="Adrian" />
|
||||
<property name="attachment" value="screenshots/dashboard.png" />
|
||||
<property name="attachment" value="screenshots/users.png" />
|
||||
<property name="description">
|
||||
This text describes the purpose of this test case and provides
|
||||
an overview of what the test does and how it works.
|
||||
</property>
|
||||
</properties>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
42
__tests__/fixtures/python-xunit-pytest.xml
Normal file
42
__tests__/fixtures/python-xunit-pytest.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<testsuites name="pytest tests">
|
||||
<testsuite name="pytest" errors="0" failures="2" skipped="2" tests="15" time="0.019"
|
||||
timestamp="2025-11-15T11:51:49.548396-05:00" hostname="Mac.hsd1.va.comcast.net">
|
||||
<properties>
|
||||
<property name="custom_prop" value="custom_val"/>
|
||||
</properties>
|
||||
<testcase classname="tests.test_lib" name="test_always_pass" time="0.002"/>
|
||||
<testcase classname="tests.test_lib" name="test_with_subtests" time="0.005"/>
|
||||
<testcase classname="tests.test_lib" name="test_parameterized[param1]" time="0.000"/>
|
||||
<testcase classname="tests.test_lib" name="test_parameterized[param2]" time="0.000"/>
|
||||
<testcase classname="tests.test_lib" name="test_always_skip" time="0.000">
|
||||
<skipped type="pytest.skip" message="skipped">/Users/mike/Projects/python-test/tests/test_lib.py:20: skipped
|
||||
</skipped>
|
||||
</testcase>
|
||||
<testcase classname="tests.test_lib" name="test_always_fail" time="0.000">
|
||||
<failure message="assert False">def test_always_fail():
|
||||
> assert False
|
||||
E assert False
|
||||
|
||||
tests/test_lib.py:25: AssertionError
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="tests.test_lib" name="test_expected_failure" time="0.000">
|
||||
<skipped type="pytest.xfail" message=""/>
|
||||
</testcase>
|
||||
<testcase classname="tests.test_lib" name="test_error" time="0.000">
|
||||
<failure message="Exception: error">def test_error():
|
||||
> raise Exception("error")
|
||||
E Exception: error
|
||||
|
||||
tests/test_lib.py:32: Exception
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="tests.test_lib" name="test_with_record_property" time="0.000">
|
||||
<properties>
|
||||
<property name="example_key" value="1"/>
|
||||
</properties>
|
||||
</testcase>
|
||||
<testcase classname="custom_classname" name="test_with_record_xml_attribute" time="0.000"/>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
@@ -73,6 +73,46 @@ describe('java-junit tests', () => {
|
||||
fs.writeFileSync(outputPath, report)
|
||||
})
|
||||
|
||||
it('report from testmo/junitxml basic example matches snapshot', async () => {
|
||||
const fixturePath = path.join(__dirname, 'fixtures', 'external', 'java', 'junit4-basic.xml')
|
||||
const outputPath = path.join(__dirname, '__outputs__', 'junit-basic.md')
|
||||
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||
|
||||
const opts: ParseOptions = {
|
||||
parseErrors: true,
|
||||
trackedFiles: []
|
||||
}
|
||||
|
||||
const parser = new JavaJunitParser(opts)
|
||||
const result = await parser.parse(filePath, fileContent)
|
||||
expect(result).toMatchSnapshot()
|
||||
|
||||
const report = getReport([result])
|
||||
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
|
||||
fs.writeFileSync(outputPath, report)
|
||||
})
|
||||
|
||||
it('report from testmo/junitxml complete example matches snapshot', async () => {
|
||||
const fixturePath = path.join(__dirname, 'fixtures', 'external', 'java', 'junit4-complete.xml')
|
||||
const outputPath = path.join(__dirname, '__outputs__', 'junit-complete.md')
|
||||
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||
|
||||
const opts: ParseOptions = {
|
||||
parseErrors: true,
|
||||
trackedFiles: []
|
||||
}
|
||||
|
||||
const parser = new JavaJunitParser(opts)
|
||||
const result = await parser.parse(filePath, fileContent)
|
||||
expect(result).toMatchSnapshot()
|
||||
|
||||
const report = getReport([result])
|
||||
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
|
||||
fs.writeFileSync(outputPath, report)
|
||||
})
|
||||
|
||||
it('parses empty failures in test results', async () => {
|
||||
const fixturePath = path.join(__dirname, 'fixtures', 'external', 'java', 'empty_failures.xml')
|
||||
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||
|
||||
@@ -15,9 +15,9 @@ describe('python-xunit unittest report', () => {
|
||||
const fixturePath = path.join(__dirname, 'fixtures', 'python-xunit-unittest.xml')
|
||||
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||
const outputPath = path.join(__dirname, '__outputs__', 'python-xunit-unittest.md')
|
||||
|
||||
it('report from python test results matches snapshot', async () => {
|
||||
const outputPath = path.join(__dirname, '__outputs__', 'python-xunit.md')
|
||||
const trackedFiles = ['tests/test_lib.py']
|
||||
const opts: ParseOptions = {
|
||||
...defaultOpts,
|
||||
@@ -68,3 +68,26 @@ describe('python-xunit unittest report', () => {
|
||||
expect(report).toMatch(/^# My Custom Title\n/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('python-xunit pytest report', () => {
|
||||
const fixturePath = path.join(__dirname, 'fixtures', 'python-xunit-pytest.xml')
|
||||
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||
const outputPath = path.join(__dirname, '__outputs__', 'python-xunit-pytest.md')
|
||||
|
||||
it('report from python test results matches snapshot', async () => {
|
||||
const trackedFiles = ['tests/test_lib.py']
|
||||
const opts: ParseOptions = {
|
||||
...defaultOpts,
|
||||
trackedFiles
|
||||
}
|
||||
|
||||
const parser = new PythonXunitParser(opts)
|
||||
const result = await parser.parse(filePath, fileContent)
|
||||
expect(result).toMatchSnapshot()
|
||||
|
||||
const report = getReport([result])
|
||||
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
|
||||
fs.writeFileSync(outputPath, report)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
name: Test Reporter
|
||||
description: |
|
||||
Shows test results in GitHub UI: .NET (xUnit, NUnit, MSTest), Dart, Flutter, Java (JUnit), JavaScript (JEST, Mocha)
|
||||
description: Displays test results from popular testing frameworks directly in GitHub
|
||||
author: Michal Dorner <dorner.michal@gmail.com>
|
||||
inputs:
|
||||
artifact:
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "test-reporter",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "test-reporter",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.11.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "test-reporter",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"private": true,
|
||||
"description": "Presents test results from popular testing frameworks as Github check run",
|
||||
"main": "lib/main.js",
|
||||
|
||||
4826
reports/jest/package-lock.json
generated
4826
reports/jest/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
1453
reports/mocha/package-lock.json
generated
1453
reports/mocha/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,6 @@
|
||||
"author": "Michal Dorner <dorner.michal@gmail.com>",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"mocha": "^8.3.0"
|
||||
"mocha": "^11.7.5"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user