Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Need a sample xml or template to push the testresults from jenkins to testrails


When we tried to push the automation test results (fitnesse) by converting them to junit format, But we are not successful and getting the error
Please help us and we are using this plugin achikin/testrail-jenkins-plugin

[ValidationException] Field :results cannot be empty (one result is required)

File: /var/www/html/sys/helpers/ex.php
Line: 25
Status Code: 500
Uri: /index.php?/api/v2/add_results_for_cases/48 (POST)

Browser: Jakarta Commons-HttpClient/3.1
PHP: 5.4.16
Server: Linux 3.10.0-123.20.1.el7.x86_64 #1 SMP Thu Jan 29 18:05:33 UTC 2015 x86_64

at ex::raise (ex.php:25)
at ex::raise (ex.php:43)
at ex::raisev (ex.php:73)
at ex::raiset (v2.php:2988)
at V2_controller->_add_results_validate_common (v2.php:3020)
at V2_controller->add_results_for_cases (controller.php:215)
at Controller->_invoke_web_call (controller.php:127)
at Controller->_invoke_web (controller.php:76)
at Controller->_invoke (gizmo.php:107)
at require_once (index.php:106)



Thanks for your posting! I believe you are on the right track but it appears that you use add_results_for_cases in a slightly incorrect way. You can find a full example and the expected parameters by this API method here (see Request Example):

The example uses raw curl/JSON, but this can be translated to Java and the Java API binding. Are you already using the Java API binding and could you share the relevant code snippet how you use the binding?



Currently I am using the Jenkins plugin and Not sure how they are using that. I am looking for the jenkins results.xml sample


The results.xml file should be created as part of the Jenkins build/run and this would be independent of TestRail. You should be able to find the file as part of your Jenkins directories and/or repository.

I hope this helps!



The results.xml file is generated and it is available in jenkins workspace, I want to know the format of the xml file.

Is there any other ways i can upload/import the UI automation test results(TestRun) in xml format to the testrails. Can u please explain with an example. This json format is quite confusing.


Sure, TestRail’s XML format is documented here:

This is independent of the Jenkins results.xml file though. I believe the Jenkins plugin would be the easiest way to integrate TestRail and Jenkins. There’s also a thread on this forum that might help:



My scenario is to upload the test results to testrails without any manual intervention.

Is there any ways to upload xml for testruns through API and what are the mandatory fields needs to be mapped in xml


Transforming an XML file into another format is not trivial and we would recommend our easy to use JSON-based API instead. Instead of using the Jenkins plugin, you can also write a simple script or tool yourself that goes through the XML file and sends the corresponding API requests to TestRail’s API. You can also use our TestRail API binding for Java in this case so you don’t have to deal with the low-level details of the API such as the JSON format or authentication: