Forum Discussion

RobWithers's avatar
RobWithers
Occasional Contributor
12 years ago

[Resolved] Trigger a listener when just a test step is run

I am trying to trigger a listener to manage my test environment, just when a test step is run, without the surrounding test case being run. Is there a way to do this?

Thanks!

2 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    Unfortunately, I don't think this is easily done. If you take a look at the "Events" tab in the project view, you can set up groovy scripts to be run triggered by different events, but I haven't been able to produce a solution for your exact case. These events operate on a TestSuite and TestCase level, and it's difficult to differentiate between a TestStep being run individually and it being run together with an entire TestCase. The TestRunListener.beforeStep event, which seemed like it could help, is actually triggered only in TestSteps run from a TestCase, and not for those run individually.

    Let me know if I have misunderstood you, or if I can assist you further in any other way.

    Regards,

    Arian
    SmartBear Sweden
  • RobWithers's avatar
    RobWithers
    Occasional Contributor
    That's too bad. It is inconsistent. If you allow a test step to be run alone, one should have the ability to install a listener to it, just like with a test suite or test case. It is ok, as I have managed a workaround, but still.

    Thanks for the support!