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


#1

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)

Details:
File: /var/www/html/sys/helpers/ex.php
Line: 25
Status Code: 500
Host: probe.cliqr.com
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

Trace:
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)


#2

Hello,

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):

http://docs.gurock.com/testrail-api2/reference-results#add_result_for_case

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?

http://docs.gurock.com/testrail-api2/bindings-java

Cheers,
Tobias


#3

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


#4

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!

Cheers,
Tobias


#5

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.


#6

Sure, TestRail’s XML format is documented here:

http://docs.gurock.com/testrail-userguide/howto-import

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:

Cheers,
Tobias


#7

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


#8

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:

http://docs.gurock.com/testrail-api2/bindings-java

Cheers,
Tobias


#9

Hi,

I have the same problem. I need a sample *.xml format that the plugin is looking for. It gave me the same error " Field :results cannot be empty (one result is required)" when I tried to post the result to testrail from Jenkins through plugin. I looked at the xml files and none of it has a results node. Sample xml format that jenkins generated is

<testsuite errors=“0” failures=“1” name="" skipped=“0” tests=“1” time=“186.94” timestamp=“2018-07-201 08:14:02”>

<testcase classname="" name=“Table test”>

<failure message=“element Recent was not found” type=“java.lang.AssertionError”>element Recent was not found</failure>

<system-err>

</system-err>

</testcase>

</testsuite>

@dprabhua: Can you please let me know how did you solve your error?