cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling specific test case using project Setup Script

SOLVED
Highlighted
Occasional Contributor

Disabling specific test case using project Setup Script

I have the below script to disable a TestSuite using the project Setup Script.

 

//get the environment name
def env =  runner.project.getActiveEnvironment().name
//def testsuite name
def ts = runner.project.getTestSuiteByName("Testsuite1")
//disable the test suite
ts.setDisabled(true)
//disable the test suite based on environment
if (env == "Environment 1"|| 
env == "Environment 5")
{
ts.setDisabled(false)
}
else
{
ts.setDisabled(true)
}

How can a make a similar script, again from project Setup Script, but to disable specific test cases instead?

 

Thanks

David

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super Contributor

The WsdlTestCase class has the setDisabled method so from a Project start up script which provides you with the variable "project" you can use the following:

 

project.getTestSuiteByName("TestSuite 1").getTestCaseByName("TestCase 2").setDisabled(true)

 

View solution in original post

1 REPLY 1
Highlighted
Super Contributor

The WsdlTestCase class has the setDisabled method so from a Project start up script which provides you with the variable "project" you can use the following:

 

project.getTestSuiteByName("TestSuite 1").getTestCaseByName("TestCase 2").setDisabled(true)

 

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get a full Raw JMS request

Participate!

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors