Skip to main content

xUnit

Submit and collect your xUnit results in Testiny to track automated test runs. By integrating xUnit with Testiny, you can gain valuable insights into your testing process. Track automation results over time, identify frequently failing tests, and detect patterns in test failures to fix CI failures and find flaky tests.

xUnit

Run xUnit & Generate xUnit XML Reports

xUnit tests can be run in different ways, such as command line, dotnet test, JetBrains Rider or Visual Studio. Some IDEs might automatically generate xUnit style reports, for some you might need to configure an xUnit XML reporter.

For example, to create xUnit Style XML reports with dotnet test, install the XunitXml.TestLogger package and specify the reporter with --logger option:

dotnet test --logger "xunit;LogFileName=TestOutputResults.xml"

In the next step, learn how to import the results from the XML reports to Testiny.

Import Results to Testiny

Make sure you've generated an API key and use the Testiny CLI to import the results to Testiny:

export TESTINY_API_KEY=****
npx @testiny/cli automation --project ID_OR_KEY --source "frontend" --xunit TestOutputResults.xml 

In the above example, the environment variable TESTINY_API_KEY is set to authenticate the request. The --project flag specifies the target Testiny project using its ID or key and the --source flag categorizes the test results (e.g., frontend, backend, integration tests, ...). The --xunit flag specifies the format of the specified test result file(s).

Once executed, the Testiny CLI will automatically create a new automated test run in Testiny and import all results from the specified report(s).

More resources

Here are some further resources to help you get started with integrating xUnit with Testiny, including CI/CD integration examples, a full automation guide, and the Testiny CLI.