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

Accessing test cases by their test ID


#1

Hello all, I’ve been doing some research this last week on building a complete CI system for my company’s product. I’ve been set to the task of setting up the service by myself, and I’m running into some problems, namely the one this post is about.

The system I am writing is using the javascript QUnit testing framework to send results of individual tests to Testrail after they have all finished running. However, sending a test to Testrail requires that I have the ID of the test, and from what I can tell the test cases get a new ID in every test run. Is there a way to consistently access a testcase (i.e. an id that will always point to a particular test)?

On another note, when sending test results automatically do I need to actually have a new testrun set up every time I submit test results? How do automatic tests get recorded in Testrail?

If anyone could provide some insight to any of these questions, I would greatly appreciate it :slight_smile: Be aware that you are helping a young college student learn how to do some really cool stuff :slight_smile:


#2

Hello Max,

Thanks for your posting. Please have a look at the add_result_for_case API method which expects a test run ID + case ID (instead of a test ID). The case ID (C#) is static and never changes (as opposed to the test ID T# which changes with every test run). Please also see the documentation of add_result/add_result_for for more details about the differences between the T# and C# IDs:

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

The general idea for automated tests is to create new test runs/plans (via add_run/add_plan), store the returned test run IDs (e.g. in memory) and then submit test results using the static case ID and IDs of the new test runs (via add_result_for_case).

I hope this helps!

Regards,
Tobias