Forum Discussion

AnandKiran's avatar
AnandKiran
Frequent Contributor
15 years ago

How to get the names of all the testcases under the testsuite using Groovy

Hi,

Is there a way to get all the testcases under the testsuite using a groovy script. If so can any one provide the code to acheive it?

Thanks in Advance.
Regards
Anand
  • You can use the following piece of code:


    def testSuite = testRunner.testCase.testSuite.project.testSuites['Your_TestSuite_Name'];

    for(int i=0; i
    log.info  testSuite.getTestCaseAt(i).getName();
    }


    Hope this might help you!
    regards,
      depeche
  • Hi sabereshcp,
           You can make use of the following method to achieve so:

    def testSuite = testRunner.testCase.testSuite.project.testSuites['Your_TestSuite_Name'];
     
    for(int i=0; i
           // isDisabled() mehod returns boolean value (i.e true or false)
           if(!testSuite.getTestCaseAt(i).isDisabled())
          {

                  // Lists out the name of enabled testcases
                  log.info testSuite.getTestCaseAt(i).getName();
          }
           
    }

    Hope this might help you!
    regards,
      depeche
  • Hi depeche,

    Is it possible to fetch the names of the testcases which are enabled(Which are getting executed) in a testsuite...



    Thanks in Advance,
    Saberesh C P