Forum Discussion

Bram_Baptiste's avatar
Bram_Baptiste
Occasional Contributor
17 years ago

Running testStep in groovy script

Hi,

I want to do 50 times a testStep with different parameters in a loop.
I think the best way to do this is in a groovy script.

the teststep is createTerminal.

But in the loop the mac address of the createTerminal has to change.

Is this feasible?

And if yes, can somebody guide me the way?

Tia, Bram

2 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    This sounds like a candidate requirement for the DataSource related functionality in soapUI Pro. Are you?

    If you are not using soapUI Pro, then groovy scripts will do the trick as well (a bit more work though..). Have a look at the template-data data scenario to get the idea: http://www.soapui.org/userguide/scenari ... riven.html

    Hope this helps!

    regards,

    /Ole
    eviware.com
  • darshan's avatar
    darshan
    New Contributor
    1) Set the Property in the property file.
    2) Next write a Property Transfer from the property to the request.
    3) After this write a groovy script to to read from the Property file and change the property.
    This can be done as follows:
    def request = testRunner.testCase.getTestStepByName( "activateRequest" );
    def property = request.getProperty( "request" );

    //get the property value from the Property file
    def props = testRunner.testCase.getTestStepByName("Properties");
    String sNo = props.getPropertyValue("sNo");
    Here sNo is the name of the property set.
    4)Use XPATH to navigate the XML file.
    use this command..its powerful..
    //sNo/text()