Forum Discussion

SanthoshShetty's avatar
SanthoshShetty
Occasional Contributor
7 years ago

Can we get the test case name in BeforeTestCase

Hi All,   We are implementing a custom framework for our project and for that we need to know the test case name in the Event handler - BeforeTestCase, so that we using the Testcase name we will wr...
  • Radford's avatar
    7 years ago

    Assuming that you are referring to the "TestSuiteRunListener.beforeTestCase" event handler, it provides you with a variable "testCase" for you to use. Thus the test case name cand be accessed via:

     

    log.info('Current Test Case = ' + testCase.getName())

     

    If you haven't already spotted, each script editor will indicate what variables it provides (see screenshot below). These will be dependent on the specific editor you are looking at.