Forum Discussion

mrdwprice's avatar
mrdwprice
Contributor
6 years ago

Disable specific testcases in a particular Environment

Can anybody give me an example Setup Script or TearDown Script that can disable specific Testcases in a particular Environment?    For example   Environment 1 Environment 2 Environment 3 ...
  • jsheph01's avatar
    6 years ago

    Here is how you get the environment name and disable a test case. In your teardown script just change setDisabled to false to enable the test case again.

     

    //get the environment name
    def env =  runner.project.getActiveEnvironment().name
    
    //disable  the test case
    def ts = runner.project.getTestSuiteByName("testSuiteName")
    def tc = ts.getTestCaseByName("testCaseName")
    tc.setDisabled(true)