Forum Discussion

vishalpatel's avatar
vishalpatel
Occasional Contributor
7 years ago

How to identify if the test case has been triggered at TC, Suit or Project level using groovy

HI,

 

How do i identify if the test case has been triggered from a Test Case level, Test Suite Level or a Project level in the called test case.

 

The structure of my project is as follows:

 

E.g say my test case TC1 has 2 test steps

 

Project

 Test Suite

   TC1

     - GET Method

     - Validate GET(Test Case Call)

   Validate GET

     - Groovy Script(Identify here if TC1 has been triggered at TC, Suite or Project Level)

 

2 Replies

  • krogold's avatar
    krogold
    Regular Contributor

    You could actually use the setup script at project level to set a property (ie. 'launcher_id') at project level, same thing at testsuite level and test case level, as there are setup scripts possibilities at each level.

    Then check these property values in your groovy script (as you can expand properties at each level), which will give you the higher level caller.

    Finally reinitialize those properties in the corresponding tear down script (project, testsuite and testcase level) (more relevant for testcase or testsuite executions)

    • vishalpatel's avatar
      vishalpatel
      Occasional Contributor

      Interesting. i can give that a try. However, i was hoping along the lines of getting a groovy script which i can use to figure that out. Is there a class or a method that returns the info around the triggering of the TC from the level?