Forum Discussion

TesterNo1's avatar
TesterNo1
Contributor
10 years ago

Enabling and disabling test cases from test suite

I have excel with all test cases for the suite.My req is to disable all testcases from test suite start  up script when the test begins.Based on if the test case is set for run (one excel cloumn woul...
  • nmrao's avatar
    nmrao
    10 years ago

    If you want to just enable  all the cases :

    testSuite.testCaseList.each { it.disabled = false }

    To disable:

    testSuite.testCaseList.each { it.disabled = true }

     

    To enable a test case by name:

    testSuite.testCases['TestCase 1'].disabled = false //you may change test case name.

    To disable:

    testSuite.testCases['TestCase 1'].disabled = true //you may change test case name.

     

    Does it help?

     

     

    EDIT: Was little confusing, after looking into details, then come to know the following:

    Are you using Test Case label in your script instead of Test Case name? There is a difference.

    log.info testSuite.testCases['TestCase 1'].name
    log.info testSuite.testCases['TestCase 1'].label

    Output:

    Wed Dec 09 07:15:07 IST 2015:INFO:TestCase 1
    Wed Dec 09 07:15:07 IST 2015:INFO:TestCase 1 (disabled)