xUnit test reporting

You can upload results data to Tesults from xUnit using a JUnit format XML file. Unlike other test frameworks, Tesults does not provide a custom listener or reporter for xUnit due to limitations in xUnit around supporting such a mechanism.

Install the NuGet package called 'JunitXml.TestLogger'. Then run your xUnit tests with the command:

dotnet test --logger:junit

An xml file will be generated after the tests are complete. Next submit this xml file to Tesults.

To upload results using an XML file utilize the /results REST API.


Method: 'POST'

Set the content-type header to 'text/xml' and set the target token in the 'Authorization' http header.


"Content-Type": "text/xml"
"Authorization": "Bearer <token>"

<token> should be replaced with the target token string provided to you on creation of your project. If you did not note down the token when you created your project you can regenerate a token for the target in the configuration menu.


Submit the xml file in the request POST body.


Example using curl with XML inline as string:

$ curl -X POST -H "Content-Type: text/xml" -H "Authorization: Bearer <token>"
  -d '<?xml version="1.0" encoding="UTF-8"?> <testsuites>...</testsuites>'

Example using curl with XML file:

$ curl -X POST -H "Content-Type: text/xml" -H "Authorization: Bearer <token>"
  -d @/path/to/xunit-results.xml https://www.tesults.com/results

If the the request is successful the response will contain a status code of 200 and include a JSON response as shown below.

status code 200 with JSON response:

  "data": {
     "code": 200,
     "message": "Success"

If there is an error there will be a status code other than 200 with JSON response as shown:

status code other than 200, for example 400, 401, 403, 429, 500 with JSON response:

  "error": {
     "code": 400,
     "message": "Missing required parameters - target and results are required"

The error message will provide detail as to the specific reason for the failed request.

Fix the error displayed in the error message and try again to get a successful response.

Your team members will be able to view your uploaded test results immediately after a successful response. Any notificiation recipients you have configured will be notified about the availability of the new results by email.