Here’s a tip on how to write a little piece of code to skip your test case in your test suite.
From the Test Listeners, under @BeforeTestCase, add this little snippet and, when you run the suite, it will skip that test.
@BeforeTestCase
def sampleBeforeTestCase(TestCaseContext testCaseContext) {
testCaseContext.skipThisTestCase()
}
If you have Global Profiles set up with your environment urls as the profile, you can also adjust it to determine the url and skip a particular test if it’s in a particular environment.
@BeforeTestCase
def sampleBeforeTestCase(TestCaseContext testCaseContext) {
if (GlobalVariable.url == "https://example.com") {
if ((testCaseContext.getTestCaseId()) == "Test Cases/NameOfTestCase")
{ testCaseContext.skipThisTestCase()
println 'Closing this test in Production env'}
}
This will run the tests as PASSED in the reporting as I do not believe there is a way to ‘Mark as Skipped’ at this time.
See thread: It is possible to skip test in runtime? - #4 by Trong_Bui