Forum Discussion

mpw83's avatar
mpw83
Contributor
5 years ago
Solved

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)

5 Replies

  • 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)
    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Thanks for sharing your code, HimanshuTayal.

       

      mpw83, is this what you are looking for?

      • mpw83's avatar
        mpw83
        Contributor

        TanyaYatskovska and HimanshuTayal , 

         

        Thanks for your input, Actually I am looking for a solution through the GUI? Is there are any option to run a Test Suite as a step using GUI ? Thanks