Forum Discussion

Gordian's avatar
Gordian
Occasional Contributor
10 years ago

How to tell if a project has a name map programmatically

TestComplete 10.6, JScript, Java app in a browser     I have a script extension for some general purpose operations (JScript).  In this code I want to programmatically determine if the current Pro...
  • HKosova's avatar
    10 years ago

    In script extensions, you can check the presence of NameMapping like this:

     

    var nmExists = false;
    try {
      nmExists = NameMapping.ConfigurationCount > 0;
    }
    catch (e) {}
    
    if (nmExists)
    {
      // The current project has a name map
    }

     

    In regular test scripts, you can use this:

     

    if (typeof NameMapping !=== "undefined")
    {
      // The current project has a name map
    }
    else
    {
      // The project doesn't have a name map
    }