Forum Discussion

mczerwin's avatar
mczerwin
New Contributor
11 years ago

Determine the name of a test script

From reading the forum it seems that there is no way to deterine the name of a test script from within that test script. Is that really the case?

3 Replies

  • chrisb's avatar
    chrisb
    Regular Contributor

    Thats correct. There are no methods in Test Complete to do this. In Javascript you can get the whole function that is currently executing and then use a regex to parse the function name. See this answer  on Stack Overflow, stackoverflow.com/questions/1935521

     

    In my project I get the name of the currently running test and store it in a project suite variable by doing the following

     

    ProjectSuite.Variables.test_name = arguments.callee.toString().match(/function ([^\(]+)/)[1];