Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Getting name of current scenario that method tool is running in

LegacyForum Posts: 1,664 ✭✭
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


  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    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.