Forum Discussion

KMR's avatar
KMR
Occasional Contributor
12 years ago

Find if the current test case is the first one in testrun

Is there a way to find out if the current test that is being executed is the first test case of the test run.
Context : We might be executing either a test case or a test suite or the complete project.

Irrespective of how we execute, we want to do a particular set of action only once during the test run from the first test case of the test run. (Like create a file to log some key details from the execution)
  • SiKing's avatar
    SiKing
    Community Expert
    From the testCase SetupScript:

    def amIFirst
    amIFirst = testCase.name.equals(testCase.testSuite.testCaseList[0].name)


    Just FYI: you are aware that if you need something done at the start of a test(case | suite | project), all the levels have a Setup Script capability, right?