Ask a Question

Create a payload on groovy and call a step passing it

carlosvelloso
Visitor

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 1
ChrisAdams
Community Leader

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...

 

ChrisAdams_0-1659603908942.png

 

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

 

E.g. From....

ChrisAdams_1-1659603970958.png

 

and To.....

ChrisAdams_2-1659604002580.png

 

These groovy scripts must come before the request.

 

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

ChrisAdams_3-1659604070567.png

 

 

cancel
Showing results for 
Search instead for 
Did you mean: