mpw83
6 years agoContributor
Run Test Suite as a step
I know there is a step that I use to run a test case from a different test suite. But is there any similar way to run a Test Suite as a step? Thanks
Currently, I am using the following groovy script to call the test suite
import com.eviware.soapui.support.types.StringToObjectMap //Provide the name of the suite def suiteNameToExecute = 'Test Suite Name' def runSuite = { suiteName, async = true -> def suite = context.testCase.testSuite.project.testSuites[suiteName] suite.run([] as StringToObjectMap, async) } runSuite(suiteNameToExecute, false)
But the problem is, if the test suite is failed then it does not indicate whether it's failed or not
Hi mpw83 ,
There might be other ways, but if i stuck in this situation, what i do is below:
i get the status of Test Suite and put it in if condition, have a look at below Code snipet:
import com.eviware.soapui.support.types.StringToObjectMap //Provide the name of the suite def suiteNameToExecute = 'Test Suite Name' def runSuite = { suiteName, async = true -> def suite = testRunner.testCase.testSuite.project.testSuites[suiteName] def status = suite.run([] as StringToObjectMap, async) //Get the status of Test Suite status = status.getStatus().toString() //If status is PASS then do nothing else fail the test Runner if(status == "PASS"){ //Do Nothing }else{ testRunner.fail("Test Suite failed") } } runSuite(suiteNameToExecute, false)