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

SoapUI and TestRail - Update Test Status


#1

SoapUI and TestRail Integration

Since it took me close to a week to come up with this, I thought it would be valuable to share with the community.

Here is a quick lessons learned for beginners trying to post a status update to TestRail via an HTTP request with JSON using SoapUI

PreReqs on Terminology

TestRail Values: (note when using these values in a request with the latest version of TestRail, you omit the alpha character, but its handy for reference)
R169 - This is the run value
T17769 - This is the Test Value
C3651 - This is the Test Case Value

1. Ensure API is enabled!
It was not appearant as a standard user that our TestRail server did not have the API enabled. Check with your system Admin or if you have admin privledges. Go to Administration->Site Settings->API to turn it on.

2. Make sure your header and Security is setup properly
2a. Setting up the Header in SoapUI

  • In the SoapUI Test Case, select the Headers Tab
  • Enter Content-Type in the box under Header
  • Enter application/json in the box under value

2b. Setting Up Authentication

  • In the SoapUI Test Case, select the Type of Authorization (for this example Basic)
  • Enter User Name (the one that you would login to the TestRail webpage)
  • Enter Password (self explanatory)
  • Select Authenticate pre-emptively

3. Setting up your Test Case (See attached Screenshot)
Method - POST (for this Example POST because we are updating a Test Status)
Request URL - http://SERVERNAMEXYZ/testrail/index.php?/api/v2/add_result/17769
Parameters (the Name Value boxes right below the Request URL ) - Leave these blank
Body Text - This is where you put the values you want to update the test case with

{
“status_id”: 5,
“comment”: “failed Homie”
}

To assign a
Pass Status use “status_id”: 1
Fail Status use “status_id”: 5

You can see a list of valid values that can be used in the body in the response results. (id, test_id, etc)


Posting a Result using "add_result" with json
#2

Thanks a lot for sharing this, Derek, that’s appreciated!

Cheers,
Tobias


#3

You’re Welcome. Hope it helps.


#4

Yep, definitely great to have, thanks again.

Cheers,
Tobias


#5

Hi Derek,
If you are trying to integrate readyAPI with TestRail, you may want to try this out
http://www.agiletestware.com/firefly

disclaimer: I work for agiletestware and firefly is a commercial product.


#6

Hi @dgorney

How did you get the id for add result automatically?


#7

Hi rocuge,

Thank you for the post. In order to get this, you could use the get_plans/get_plan and/or get_run/get_runs methods, you could then add results to your tests. Once you have this, you can submit your result using the following methods:

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


#8

Hello @martylavender

Thanks

could I get test case run id based on RUN_ID + CASE_ID?