Forum Discussion

carlosvelloso's avatar
2 years ago

Create a payload on groovy and call a step passing it

Hi all,

 

I want to create a payload on groovy and call a step passing this payload

I need to do something like this:

GROOVY CODE:

<code>

 

def step = testRunner.testCase.testSteps["POST XPTO"].name;
def _from = "XXX";
def _to = "YYY";


testRunner.runTestStepByName(step, _from, _to)

 

</code>

1 Reply

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 3

    Hi,

     

    I haven't tried to 'push' values into a payload, but I have 'pulled' values in to a payload using Groovy script.

     

    Take this test case as an example...

     

     

    The first two items just return strings to use as the From and To values.

     

    E.g. From....

     

    and To.....

     

    These groovy scripts must come before the request.

     

    Then, in the payload of the request, you can 'pull' these values in.