In this article, I am going to tell you how to integrate your test automation suite with Gurock’s TestRails application. TestRail is a web-based test case management software to manage, track & organize test cases. Our aim in this tutorial is to create a test suite in TestRails before test execution, then update run results according to test automation results.

Tech Stack

  • Java
  • TestNG

Assumption

We expect you to store the automation test case in TestRail.

Here are our test cases that we keep in TestRail app.

  • Valid Login has 1 as ID
  • Invalid Login has 2 as ID

Create Annotation to Associate Test Code with Test Rails ID

We already talked about creating a custom annotation for Java project in https://www.swtestacademy.com/custom-java-annotations/
So we used the same approach and created an annotation called TestRail.

Then we associate our test cases with actual Test Rails ID’s like. Now validLogin functionality has 1 as we store this test case in TestRails with 1 as id.

Create a Test Suite in TestRail

We need to create a different suite for every execution that we execute so we’ll be able to store the result in different execution records. So we should use BeforeSuite annotation and create a Test Suite by using TestRail API’s.  You can download the TestRails Java bindings from this site so you’ll have a base structure to reach TestRails’ API’s.