Forum Discussion

RobinOng's avatar
RobinOng
Occasional Contributor
10 years ago
Solved

TestRunListener.Afterstep not fired after calling step from Groovy Script

Hello,

 

I have created a testcase where I want to control my teststeps from a Groovy script.

The layout of the case is something like this:

  • Testcase
  •     GroovyScript1
  •     GroovyScript2
  •     GroovyScript3 (From this script I call SoapRequest1)
  •     SoapRequest1

 

In my Groovy script I have the following code:

 

testRunner.testCase.getTestStepByName('SoapRequest1').run(testRunner, context);

 

I have also implemented the default TestRunListener.Afterstep. At this point in that event all I do is log a message of the type of teststep it fires on.

 

After running the case sketched above the result is:

  • Groovy
  • Groovy
  • Groovy

As you can see it never fires on the SoapRequest step. This way the event handler renders useless for me since it only hits the first 3 Groovy script and not the step I run manually from my Groovy Script.

 

Is this a knows issue or is there a solution for this?

Thank you in advance.

 

Kind Regards,

Robin Ong

  • There are two ways to do the same

     

    testRunner.runTestStepByName("nameofteststep")

     And

    testRunner.gotoStepByName( "name of the step")

     You may also look into this link for more details

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    There are two ways to do the same

     

    testRunner.runTestStepByName("nameofteststep")

     And

    testRunner.gotoStepByName( "name of the step")

     You may also look into this link for more details

    • RobinOng's avatar
      RobinOng
      Occasional Contributor

      Hi nmrao,

       

      Thank you. The .runTestStepByName call works for me.

       

      Kind Regards,

      Robin