Ask a Question

Run Test Suite as a step

SOLVED
mpw83
Contributor

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

5 REPLIES 5
HimanshuTayal
Community Hero

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)

Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
TanyaYatskovska
SmartBear Alumni (Retired)

Thanks for sharing your code, HimanshuTayal.

 

@mpw83, is this what you are looking for?

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



@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 

I am pretty sure there is not. If you need to do this, you'd have to leverage groovy code as provided or customize it to your needs. 




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!

@groovyguy  , ok thank you. I will use Groovy script 

cancel
Showing results for 
Search instead for 
Did you mean: