Getting name of current scenario that method tool is running in

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest
I need the ability to get the name of the test suite/scenario that the current method tool is running in. For example

Say I have a setup test that starts a timer for a scenario and stores it in the context. I then have a tear down test for that scenario that gets the timer from the context and returns the total milliseconds the scenario took to execute. I would like to write a generic python method that will given a context will be able to determine what scenario (specifically the name) it is running in.

Thanks in advance for the help


  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    Good afternoon Bill,

    If you look under "Help > Scripting API" you can find many public methods dealing with the context. Specifically, the Context.getParentContext() and Context.getContextName() should be helpful to you.

    A note of advice: the "parent" may not perfectly mirror the test hierarchy, as contexts are also used internally to represent the object model. I can only suggest that you test how many levels up of getParentContext() before you reach the actual test suite/scenario.

Sign In or Register to comment.