JUnit Reporter
JUnit Reports
JUnit XML format is standard among test runners on various platforms. Testomat.io can load XML reports from test runners and create tests in a project from it. If your framework is not supported yet, generate JUnit report and upload it into Testomat.io
Testomat.io will not only create a run report but also collect all information about tests, including source code, and create tests in a system as regular importer do. The only difference that normal process of Testomat.io import does not require executing tests on import, while importing via reporter requires to have tests executed and XML report provided.
Tested Frameworks:
- JUnit (JUnit)
- Python (Pytest)
- Minitest (Ruby)
- PHPUnit (PHP)
- NUnit (C#)
To enable Testomatio Reporter install @testomatio/reporter
package
Use one of your favorite package managers:
Run your test framework and generate a JUnit report.
Then import XML report into Testomat.io
pattern
- is a glob pattern to match all XML files from report. For instance,"test/report/**.xml"
or justreport.xml
--lang
option can be specified to identify source code of the project. Example:--lang=Ruby
or--lang=Java
or--lang=Python
. Possible values:c#
java
ruby
python
php
--java-tests
option is avaiable for Java projects, and can be set if path to tests is different thensrc/test/java
. When this option is enable,lang
option is automatically set tojava
--env-file <envfile>
option to load environment variables from .env file. Inside env file TESTOMATIO credentials likeTESTOMATIO
api key or bucket config for artifats.--timelimit <time>
set a timer to silently kill a long-running reporter process due to network or other issues. For instance, use--set-timeout=3
to stop process after 3 secs.
Pytest
Run pytest tests and generate a report to report.xml
:
Import report with this command
JUnit
Run tests via Maven, make sure JUnit report was configured in pom.xml
.
Import report with this command:
[!NOTE] If your tests are located in a folder other other than
src/test/java
, specify a path to test files using--java-tests
option:--java-tests="path/to/tests"
Screenshots or videos from tests are uploaded if test contains output with a path to file of following format:
Use System.out.println
to print an absulute path to file that should be uploaded as a screenshot.
This will produce XML report which contains path to a file:
When XML report is uploaded, all files from file://
will be uploaded to corresponding tests.
Assign Test ID
Test IDs can be taken applied to a test name. So to assign a test in a result to to test in Testomat.io with ID @T8acca9eb
add this ID to a test name if your test framework allows setting test names as a string.
To place a test inside a specific sute you can set a suite ID similarly to a test ID:
If a file with a source code is available to a reporter, you can link test in the test body and specify Test ID as a comment:
In this case @TT8acca9eb
is ID of existing test inside Testomat.io project
Alternatively, if the code can’t be imported by a reported, use output inside a test to print its ID:
NUnit
Generate NUnit XML report and run the following code:
If NUnit generates <ResultFiles>
section in XML report, all items from it will be uploaded as artifacts. For instance, this is available for Playwright DotNet integration.
To upload an arbitrary file as artifact, print its absulute path to console:
Assign Test ID
To link test in source code with test in Testomat.io print a Test ID inside a test:
Use tid://
prefix with a existing Test ID to match test with ID.
Ruby Minitest
Launch tests:
Import reports from test/reports
directory:
Assign Test ID
Add test ID to a test name prefixed with @T
. For instance, to link test from source code to test with id @T8acca9eb
add TID to a test title:
To place a test inside a specific sute you can set a suite ID similarly to a test ID:
To link test in source code with test in Testomat.io print a Test ID inside a test:
Use tid://
prefix with a existing Test ID to match test with ID.
PHPUnit
Generate PHPUnit XML and import it