Hi everyone! Today I want to tell you how to use Codeception with Testrail.
First of all:
We have to create an account of Testrail (it has trial on 30 days)
It is required check box api in admin panel (Administration->Manage site settings->API)

Create the api key (My settings->Api keys)

Create the project
Create the Test Suite
Create the Test Case

We need to install an extension from Bookit via composer. here this extension
composer require bookit/codeception-testrail --dev
To work this extension we need to add it to codeception.yml
next
It is important to add valid user, apiKey, and url of TestRail server to connect to. You also need to specify project
which is an id of a project you are working on. In our example it is 5.
- In order to tests to be attached to testcases we need to add anotations (
@tr-suite
and @tr-case
) before test methods. This require you to have corresponding test suite and test case created in TestRails. Here is an example for suite 7 and testcase 83.
For example
class TestCest
{
/**
* @tr-suite 7
* @tr-case 83
*/
public function loginSuccess(AcceptanceTester $I, \Page\Login $loginPage) {
$loginPage->login();
$loginPage->loginInvalid('test@gmail.com', '123456');
$I->see('From your My Account Dashboard you have the ability to view','div.welcome-msg');
$loginPage->logout();
}
HINT: you can get project
, testcase
, and testsuite
ids from their URLs. They are all integers.
Please note, this Extension is working only Cest tests.