Forum Discussion

mpw83's avatar
mpw83
Contributor
6 years ago

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 scri...
  • HimanshuTayal's avatar
    6 years ago

    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)