cancel
Showing results for 
Search instead for 
Did you mean: 

Run Test Suite as a step

SOLVED
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

1 ACCEPTED SOLUTION

Accepted Solutions
Community Leader

Re: Run Test Suite as a step

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, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
5 REPLIES 5
Community Leader

Re: Run Test Suite as a step

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, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
Community Manager

Re: Run Test Suite as a step

Thanks for sharing your code, HimanshuTayal.

 

@mpw83, is this what you are looking for?

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Contributor

Re: Run Test Suite as a step

@TanyaGorbunova 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 

Community Hero

Re: Run Test Suite as a step

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!
Contributor

Re: Run Test Suite as a step

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

New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video
Top Kudoed Authors