Ask a Question

have access to the name of the current test

have access to the name of the current test

This can be useful in naming objects and in custom logging.  Right now the user has to find some way to record it separately, but TestComplete already knows this name so it should be easy to expose. 

14 Comments
meinTest
Occasional Contributor

For JavaScript, I found the following workaround. Maybe it will help others.

I create a try-catch block. Within the try I provoke an exception, this one I catch-up with the catch and read-out the function name in the stack.

 

Note: this also works across several units -> USEUNIT

function getCaller(){
  let arrStackLines = [];

  try{
    throw new Error("throw a error to get the stack");
  }catch(objE){
    arrStackLines = objE.stack.split("\n");
  }
  let strLine = arrStackLines[arrStackLines.length -1];
  let intStart = strLine.indexOf("at ") + 3;
  let intEnd = strLine.indexOf("(<");
  Log.Message(strLine.substring(intStart, intEnd));
}

 

Best regards 

 

sign.png

  meinTest GmbH

  www.meinTest.software

 

 SmartBear preferred value-added Service

 Provider in the DACH region

Status changed to: Selected for Development

Targetted for 14.20, September 2019. 

Marsha_R
Champion Level 2

We got it!

 

 Applies to TestComplete 14.20, last modified on September 11, 2019

testname.GIF

TanyaYatskovska
SmartBear Alumni (Retired)
Status changed to: Implemented

TestComplete 14.20 provides the CurrentTestCase property that returns information on the test case that is currently running. More information:

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqtestcase/currenttestcase...

 

 

Announcements
Welcome to the TestComplete Feature Requests board!

Here you can review submitted feature requests and vote up the ones you like! If you can't find the feature you want - go ahead and suggest your own idea. Ideas with the highest rating can be implemented in the product.

Check out the Create a Feature Request guide for more information.
New Here?
Welcome to the Community
Sign Up Here