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

Need to create a new Test Run each time when I execute a particular test suite using automation


#1

Need to create a new Test Run each time when I execute a particular test suite using automation.

My case:
I have multiple test suite in TestRail like smoke test, Regression tests etc.

I want to create a new test run each time when I execute any of the test suites. (Smoke or Regression)

Currently I am using codeception as testing framework and added php testrail api in the project.
I am able to post the results to the testrail(when test run created manually) but unable to create a new test run each.

Can anyone help me in this?


#2

Hello Nupur,

Thanks for your posting! Sure, happy to help. You can also create a new test run as part of your test automation and you can use the add_run API method in this case:

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

So instead of starting a test run manually via the UI, you would use add_run, remember the returned run ID and then use this ID when submitting test results (e.g., via add_result_for_case).

I hope this helps!

Cheers,
Tobias


#4

I am getting this error:

[TestRailAPIException] TestRail API returned HTTP 400 (“Field :suite_id is a r
equired field.”)

$I->send_post(“add_run/Project_id/Suite_Id”,"");

While I am able to create testrun when I have only 1 suite in a project


#5

Hello Nupur,

Thanks for your posting. Can you share the full example you use? For add_run, you would need to pass the suite ID as part of the request data and not as part of the URL.

http://docs.gurock.com/testrail-api2/reference-runs#add_run

So, it looks more like the following (pseudo-code):

$data = [];
$data['suite_id'] = 10; // The ID of the suite
$client->send_post("add_run/5", $data); // Project ID is passed via URL

The reason for this is that the suite ID is optional in single-suite mode.

Cheers,
Tobias


#6

Hi everyone! Yesterday I faced with configuring Codeception and Testrail and I got a qustion issue.
So first of all I downloaded this plugin - here
Secondary I added in my config file following

And that all. In my opinion I need to run unit tests in order to switch to testrail (maybe I’m wrong). I tried and I received next error

- ConnectionTest: Set userPHP Fatal error:  Class 'BookIt\Codeception\TestRail\Connection' not found in /home/alex/PhpStormProjects/codeception-testrail/tests/unit/ConnectionTest.php on line 19

Please help me. What I’m wrong do it. This solution is difficult for me, because I didn’t face before


#7

Hi Alex,

This looks like an issue with the Codeception plugin and it looks like the plugin may be incomplete or some files are missing. We don’t have experience with this plugin unfortunately but we can recommend using our official API binding which is available here:

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

Cheers,
Tobias


#8

Thanks ! Can I use testrail-api for Codeception?
I downloaded tesrail-api(testrail.php) and added to my project.

I’m not programmer (maybe I’m doing wrong). What next? Maybe I need to add some request(Get or Post)?
When I run my tests(Codeception) via console I’m typing

codecept run acceptance TestCest.php 

Could you tell please how can run test in order to switch to testrail


#9

Hi Alex,

We don’t have experience with Codeception unfortunately but using the API binding is only one part of getting it to work. The API binding can “only” be used to submit test results to Testrail but you would likely need to write a Codeception plugin that integrates with Codeception and which in turn uses our API binding. Do you have a developer on your team who could help with this?

Cheers,
Tobias


#10

Unfortunately We don’t have. But we have Python developers. Okey thanks.
Got a one question: Can associate with thestrail jenkins? Because I didn’t find this information


#11

Hi Alex,

Yes, you can integrate TestRail with Jenkins and our API bindings would come in handy here as well. We have API bindings for various programming languages:

http://docs.gurock.com/testrail-api2/start

We don’t have a ready to use integration for Jenkins ourselves but you can find a good overview of possible integrations and implementations here on our blog:

https://blog.gurock.com/testrail-test-automation-test-management/

Cheers,
Tobias


#12

Is this possible using selenium in java, i currently have to manually change the run number each time i create a new regression run, i currently have lots of sections within the test suite so it takes some time