Class TestRailExecutorListener

  • All Implemented Interfaces:
    org.testng.ISuiteListener, org.testng.ITestListener, org.testng.ITestNGListener

    public class TestRailExecutorListener
    extends java.lang.Object
    implements org.testng.ISuiteListener, org.testng.ITestListener
    Listen for all test cases created and update them accordingly in Test Rail (configured based on *.properties file) This is the seconds approach of updating TestRail test cases based on test execution. The initial approach was to perform queries and update test cases as we go. Running many tests in parallel or multiple suites will throw "HTTP 429 (No additional error message received)" from the server {@link http://docs.gurock.com/testrail-api2/introduction} - In order to bypass this, before we start the suite of test we query the list of test cases from current project specified in default.properties and save it in memory. - when the test is executed if the test is not in temporary collection we add it (make a post request to /add_case) - after test execution, for our test object we define the status and other details from ITestResult - after the entire tests are executed, we traverse the list of all tests executed and bulk upload their results in TestRail with just one query command.
    Author:
    Paul Brodner
    • Constructor Detail

      • TestRailExecutorListener

        public TestRailExecutorListener()
    • Method Detail

      • onStart

        public void onStart​(org.testng.ISuite suite)
        Specified by:
        onStart in interface org.testng.ISuiteListener
      • onFinish

        public void onFinish​(org.testng.ISuite suite)
        Specified by:
        onFinish in interface org.testng.ISuiteListener
      • onTestStart

        public void onTestStart​(org.testng.ITestResult currentTest)
        Specified by:
        onTestStart in interface org.testng.ITestListener
      • onTestSuccess

        public void onTestSuccess​(org.testng.ITestResult result)
        Specified by:
        onTestSuccess in interface org.testng.ITestListener
      • onTestFailure

        public void onTestFailure​(org.testng.ITestResult result)
        Specified by:
        onTestFailure in interface org.testng.ITestListener
      • onTestSkipped

        public void onTestSkipped​(org.testng.ITestResult result)
        Specified by:
        onTestSkipped in interface org.testng.ITestListener
      • onTestFailedButWithinSuccessPercentage

        public void onTestFailedButWithinSuccessPercentage​(org.testng.ITestResult result)
        Specified by:
        onTestFailedButWithinSuccessPercentage in interface org.testng.ITestListener
      • onStart

        public void onStart​(org.testng.ITestContext context)
        Specified by:
        onStart in interface org.testng.ITestListener
      • onFinish

        public void onFinish​(org.testng.ITestContext context)
        Specified by:
        onFinish in interface org.testng.ITestListener