Forum Discussion

M_McDonald's avatar
M_McDonald
Super Contributor
16 years ago

Detect if one test case is being run from another

Is there any way to determine if a test case is being run via the 'Run TestCase' step, and which properties are being passed as parameters? I want to initialize certain values only when called this way.

4 Replies

  • Hi!

    yes.. the following properties are set in the context of the called TestCase;

    (excerpt from java code)

    properties.put( "#CallingRunTestCaseStep#", this );
    properties.put( "#CallingTestCaseRunner#", testRunner );
    properties.put( "#CallingTestRunContext#", testRunContext );

    so in your target testcase you can do

    // running from a run testcase?
    if( context.getPropertyValue( "#CallingTestCaseRunner#" ) != null )
    {
      ...
    }

    hope this helps!

    regards,

    /Ole
    eviware.com
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    OK, I had to use context.getProperty( "#CallingTestCaseRunner#" ) instead, but that worked.

    Now is there a way to detect which properties were marked for return so I could clear their values, specifically from the Setup script?

    Thanks!