cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way I can input a specific value what will only run tests with that value

SOLVED
Occasional Contributor

Is there a way I can input a specific value what will only run tests with that value

Hey Folks, 

 

I'm wanting to input a specific value before running my tests that will allow me to only run tests that have that specific value in the Datasource. 

 

Would I be able to do this in TestRunner under Global/System/Project Properties? Each test has multiple iterations I would want to skip the iterations that don't contain the variable that has been inputed. I imagine that this could be done with a Groovy script inserted into each step but I need to know what to specify the value to be ran. 

 

Many thanks!

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: Is there a way I can input a specific value what will only run tests with that value

Hi Caz88,

 

if I understand you correctly, your question is only, how you access the global properties from a groovyScript, right?

 

If yes, the answer is as follows:

def objGlobalProperties = com.eviware.soapui.SoapUI.globalProperties;

//set the global property -> if the property does not exist then it will be created automatically
objGlobalProperties.setPropertyValue("globalPropertyName", "globalPropertyValue");

//get the global property 
def strValue = objGlobalProperties.getPropertyValue("globalPropertyName");

log.info("The value is:" + strValue);

 

Best regards 

 

sign.png

  meinTest GmbH

  www.meinTest.software

 

 SmartBear preferred value-added Service

 Provider in the DACH region

5 REPLIES 5
Occasional Contributor

Re: Is there a way I can input a specific value what will only run tests with that value

Hi Caz88,

 

if I understand you correctly, your question is only, how you access the global properties from a groovyScript, right?

 

If yes, the answer is as follows:

def objGlobalProperties = com.eviware.soapui.SoapUI.globalProperties;

//set the global property -> if the property does not exist then it will be created automatically
objGlobalProperties.setPropertyValue("globalPropertyName", "globalPropertyValue");

//get the global property 
def strValue = objGlobalProperties.getPropertyValue("globalPropertyName");

log.info("The value is:" + strValue);

 

Best regards 

 

sign.png

  meinTest GmbH

  www.meinTest.software

 

 SmartBear preferred value-added Service

 Provider in the DACH region

Highlighted
Occasional Contributor

Re: Is there a way I can input a specific value what will only run tests with that value

Hi @meinTest 


Thanks for the reply. 

 

As a user I want to be able to specify which regions I want my tests to run in before I run the tests. If I set a global property the way you suggested will this me to prevent the other regions from running. 

 

The locales are set in the DataSouce so I want to skip the tests that haven't been selected. 

 

 

Occasional Contributor

Re: Is there a way I can input a specific value what will only run tests with that value

Hi @caz88 


I do not know how your project is constructed and how exactly you access your datasource but you
can skip the execution of the testcases with the following approach:

 

def objGlobalProperties = com.eviware.soapui.SoapUI.globalProperties;

//set the global property -> if the property does not exist then it will be created automatically
objGlobalProperties.setPropertyValue("globalPropertyName", "globalPropertyValue");

//get the global property 
def strValue = objGlobalProperties.getPropertyValue("globalPropertyName");

//cancel testCase if value is not equal the dataSource value
if(strValue != "value from dataSource"){
	testRunner.cancel("skip testCase execution");
}

 

Best regards 

 

sign.png

  meinTest GmbH

  www.meinTest.software

 

 SmartBear preferred value-added Service

 Provider in the DACH region

 

Occasional Contributor

Re: Is there a way I can input a specific value what will only run tests with that value

@meinTest 

 

These are great tips and have let me figure out how to come at this problem. Except when you cancel the TestRunner it stops running through to the next TestCase. 

 

Test are step up as follows:

Set Datasource Path (Groovy) 

Datasource (csv file) 

Set Endpoint (Groovy)

Rest Request 

Datasource Loop - goes to the next iteration of the csv file 

 

To improve efficency we would like to select set one specific region and run through all of our tests from just that region. 

 

Community Hero

Re: Is there a way I can input a specific value what will only run tests with that value

I moved this to the SoapUI Pro forum from the SoapUI Open Source forum because DataSource is a ReadyAPI only feature.

 

Can somebody please help caz88?

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