mrdwprice
6 years agoContributor
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
Project
TestSuite
Testcase1
Testcase2
TestSuite
Testcase3
Testcase4
TestSuite
Testcase5
Testcase6
If Environment = Environment 1,Environment 3
then disable Testcase 1, Testcase 4, Testcase 6
else enable all.
I can’t see that using tags is environment specific, so I guess a script is the way to go.
Thanks!
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)