Class TestRailApi


  • public class TestRailApi
    extends java.lang.Object
    Basic implementation of interacting with Test Rail
    Author:
    Paul Brodner
    • Field Detail

      • currentProjectID

        public int currentProjectID
      • suiteId

        public int suiteId
      • serverUrl

        protected java.lang.String serverUrl
    • Constructor Detail

      • TestRailApi

        public TestRailApi()
        Setup configuration from property file
    • Method Detail

      • getCurrentTestCase

        public TestCase getCurrentTestCase()
      • setCurrentTestCase

        public void setCurrentTestCase​(TestCase testCase)
      • toClass

        protected <T> T toClass​(java.lang.Object response,
                                java.lang.Class<T> classz)
      • toCollection

        protected <T> java.util.List<T> toCollection​(java.lang.Object response,
                                                     java.lang.Class<T> classz)
        Parse the response received and convert it to passed as parameter
        Parameters:
        response -
        classz -
        Returns:
      • hasConfigurationErrors

        public boolean hasConfigurationErrors()
      • getRequest

        protected java.lang.Object getRequest​(java.lang.String path)
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • postRequest

        protected java.lang.Object postRequest​(java.lang.String path,
                                               java.lang.Object data)
                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getSectionsOfCurrentProject

        public java.util.List<Section> getSectionsOfCurrentProject()
      • addNewSection

        public Section addNewSection​(java.lang.String name,
                                     int parent_id,
                                     int projectID,
                                     int suite_id)
      • getRun

        public Run getRun​(java.lang.String name,
                          int projectID)
      • addTestCase

        public void addTestCase​(org.testng.ITestResult result,
                                Section section,
                                TestRail annotation)
      • addTestSteps

        public void addTestSteps​(org.testng.ITestResult result,
                                 java.lang.String steps,
                                 Section section,
                                 TestRail annotation)
      • isAutomatedTestCaseInSection

        public boolean isAutomatedTestCaseInSection​(java.lang.String testName,
                                                    Section section,
                                                    TestRail annotation)
      • updateTestCaseResult

        public java.lang.Object updateTestCaseResult​(org.testng.ITestResult result,
                                                     Run run)
      • getRunOfCurrentProject

        public Run getRunOfCurrentProject()
        Returns the current Test Runs of current project
      • getFullTestCaseName

        public java.lang.String getFullTestCaseName​(org.testng.ITestResult result)
      • getSections

        public java.util.List<Section> getSections​(int projectID)
      • getRuns

        public java.util.List<Run> getRuns​(int projectID)