Forum Discussion
5 Replies
Sort By
- Jasper175Frequent ContributorWhat exactly are you trying to achieve?
The dataGen is used directly as an alternative type of Data-Driving like the DataSource.
Elaborate if you can. - JaroslawContributorI want to loop the HTTP Request test step 10 times. Not using groovy or load ui.
- DataGen - Generate a list of numbers 1...10
- Data Source
- HTTP Request
- Data Source Loop
- Jasper175Frequent ContributorOk I got it down but you can't do this without Groovy... DataSource is annoying unless you use Excel where you only have the option box "Select if rows containing empty data should be skipped"
And the problem with DataGen and DataSource is they just want to keep running until you stop it.
OPTION 1 - If you're the only user of SoapUI then use the Excel and have A1 - A10
> DataSrouce (with the checkbox mentioned above checked)
> TestStep (pointing to datasource)
> DataSourceLoop
OPTION 2 - DataGen & DataSource w/ Groovy
> DataGen (set to 1-10)
> DataSource (groovy)def numberDG = context.expand( '${DataGen#Number}' )
result["number"] = numberDG
> TestStep
> Groovy Scriptdef rawRequest = context.expand( 'your HTTP rawRequest value that is used' )
if (rawRequest == "10")
runner.cancel("End")
> DataSourceLoop
*only problem with that is it takes the runner.cancel as a failure - - Not sure how to stop/cancel gracefully
OPTION 3 - ALL GROOVY *which is the best since it works in the free version also
> Property (with one field "value")
> Groovy "SetInterval"testRunner.testCase.getTestStepByName("Properties").setPropertyValue( 'value' , '1' )
> TestStep (pointing to Property "value"
> Groovy "Loop"def rawRequest = context.expand( 'your HTTP rawRequest value that is used' )
def maxVal = "11" as int
def value = context.expand( '${Properties#value}' ) as int
if ( value < maxVal)
{
String nv = value + 1
testRunner.testCase.getTestStepByName( "Properties" )setPropertyValue( "value", nv )
testRunner.gotoStepByName("getCustomerStatus")
}
So there are the options I found that you can do
Rob - JaroslawContributorThanks Jasper but I feel we shouldn't need to resort to Groovy for something this simple.
Could this be moved to the Feature Request board? - Jasper175Frequent ContributorThat's what went through my mind why the DataSourceLoop is only tied to the DataSource... it should be allowed to use w/ a DataGen, along with a termination option when the maxVal is reached. I agree totally - but as of now I can only see those options as your alternative.
Let me know if you want me to log it - I'm just a SoapUI customer like yourself.
Related Content
- 3 years agoMoUddin
- 3 years agoLucian
- 6 years agombennison85
Recent Discussions
- 24 hours agoLukaszK