I want to disable few test cases whose name matches something. I used below script. But it does not disable the test cases
runner.project.testSuiteList.each{
def tcList=it.getTestCaseList()
tcList.each{
if(it.toString().contains("_xsi"))
it.disabled=true
}
}
Solved! Go to Solution.
Try this:
testSuite.project.getTestSuiteList().each { def tcList=it.getTestCaseList() tcList.each { log.info(it.getName()); if(it.getName().contains("B")) { it.disabled=true; } } }
I took your script and cleaned it up a bit. I had to adjust it to use the context variable, and you have to test the name of the test case object and not the object itself. Otherwise you were close.
context.testCase.testSuite.project.getTestSuiteList().each { def tcList=it.getTestCaseList() tcList.each { log.info(it.getName()); if(it.getName().contains("B")) { it.disabled=true; } } }
Thanks but when I run it says 'can not get property 'testSuite' on null object.
Where are you running the script from?
It is from Setup Script
Try this:
testSuite.project.getTestSuiteList().each { def tcList=it.getTestCaseList() tcList.each { log.info(it.getName()); if(it.getName().contains("B")) { it.disabled=true; } } }
It says 'No such property:testSuite for the class' and for your information I am running set up script at project level.
Modified the script and worked. Thank you so much.
project.getTestSuiteList().each{
def testCaseList=it.getTestCaseList()
testCaseList.each{
if(it.getName().contains("_xsi"))
{
it.disabled=true
}
}
}
I am glad you got it working! I assumed it was at the test suite level which was bad on my part.
I too missed to provide that information. Thanks!
Subject | Author | Latest Post |
---|---|---|