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

TestRail API send and display the Jenkins URL on test run level


#1

Hi there,

We have been using TestRail Api to send the results back to the test runs in TestRail dashboard. We run a Jenkins job every now and then but only post for specific builds (we have the flag that we check if we want to post the results back to TestRail for the specific Jenkins build)

We are not able to differentiate (in case we rely on latest run), since a case might happen where the job triggers the same day (automatically/scheduled) on which we explicitly ask the same job to post results to the TestRail. Two job runs different timings.

Is there a way to send the Jenkins URL back to the dashboard(at the test run level) and print it every time we want to post results to the TestRail at test run level?

Thanks,
Pratik


#2

Hi Pratik,

Thanks for your posting. Yes, you can add additional information or meta-data at the test run level via the test run description, for example. This can be structured such as a JSON blob (readable by your scripts) and something more informal that can be interpreted by both regular users in the UI but also by your scripts.

I hope this helps!

Cheers,
Tobias


#3

Hi Tobias,

I am quite not clear on this. Just to let you know that we are not making a call to ADD_PLAN_ENTRY as that test run will be manually created, that means we already have the test run id and we just pass that as an input.

I know how to pass via ADD_PLAN_ENTRY, something like:

data.put("description", "http://something.com"; //i am speaking about this URL
JSONObject obj = (JSONObject) client.sendPost(String.format(String.valueOf(uri.ADD_PlAN_ENTRY), getTestPlanId()), data);
JSONArray arr = (JSONArray) obj.get("runs");

for (int i = 0; i < arr.size(); i++) {
            JSONObject jo = (JSONObject) arr.get(i);
            testRunId = jo.get("id").toString();
}

return testRunId;

However, we do not perform above operation instead we just return the testRunId as we already have it, like this:

String testRunId = getTestRailId( ); //we have this method that takes care of providing us the run id
return testRunId; //we just return this id and then add results of tests for this

How to add the description in such a case? Also I am not able to find the description field on the test run page/level? Test plan does have a description.

Pratik


#4

Update: I am not on the TestRail 5.2 but the older version. This is why I can’t see the run description at the test run level (inside test plan). Also. I figured a way I can update the specific test run via update_plan_entry. However, I would like to have your suggestions on this OR some better approaches.

Pratik


#5

Hi Pratik,

The latest version has support for descriptions on the test run level in test plans, including add_plan, add_plan_entry and update_entry. Please note that update_plan_entry only updates the entry-level description but this is copied down to the configurations in this entry unless the configurations override the description.

Cheers,
Tobias