Forum Discussion

vitaligil's avatar
vitaligil
New Contributor
6 years ago

Passing a value from eventHandler to step Json

Hi,

 

I am trying to pass a value as parameter, from a step eventHandler script, to a different step (HTTP Request) Json body.

 

Example -

 

Step 1 Event:

 

def testStepStatus = testStepResult.getStatus().toString()
def testStepName = context.testCase.getTestStepAt(context.getCurrentStepIndex()).getLabel()
log.info(testStepName + " : " + " finished with the status " + testStepStatus + "\n")

if( testStepStatus == 'FAIL' )
{
myGotoStepName = 'testRailFailureUpdater'
log.info 'Goto step [' + myGotoStepName + ']'
testRunner.runTestStepByName(myGotoStepName)
}

 

Step 2 (testRailFailureUpdater) is HTTP Post Request with JSON body.

 

I would like to pass a value to "myGotoStepName" JSON body

 

What is the best way to achieve that?

No RepliesBe the first to reply