Integrating Robot Framework with TestRail

robot framework integration

Integrating Robot Framework with TestRail

There 3 ways to save test case execution results into the TestRail by using:

  a) Testrail Binding,
  b) Testrail Listener,
  c) Testrail API with the help of references.

Here, in our blog we are using a TestRail listener to do so.

Prerequisites:

  • Enable TestRail API for your project: Navigate to TestRail > Administration > Site Settings > API menu and enable API.
  • Install Robot Framework TestRail library using below command:

               pip install robotframework-testrail

  • Remove TestRail from path in urls:

                     <python folder path>/Lib/site-packages/TestRailListener.py         testrail_url

                     <python folder path>Lib/site-packages/TestRailAPIClient.py       self._url

  • Create a TestRun into TestRail by including all those tests which you want to run and save results.

 

Link Test Cases:

To submit test results from Robot Framework to TestRail, you need to link a test case from Robot Framework  to the one in TestRail. In order to do that, Create a tag named testrailid in each test case of robotframework to store related TestRail test case ID. This tag should store numbers only. For example, if you have a test case with ID C1929, the variable should be filled with 1929.

  So tag will be testrailid=1929

  Example:

*** Test Cases ***

Open Gmail

    [Tags]  testrailid=1929

    Open Browser https://www.gmail.com chrome

    [Teardown]    Close Browser  

 

Run Tests using listener:
pybot –listener TestRailListener.py:testrail_server_name:tester_user_name:tester_user_password:run_id:https:update  robot_suite.robot

 

Share this post