Forum Discussion

MegO's avatar
MegO
Contributor
6 years ago
Solved

Using /exit does not close TestComplete when running from a batch File

Hi,

 

I am currently running groups of Tests using a combination of a Jscript file:

 

// RunTestItemGroup.js

var testItemGroup, project;


var objArgs = WScript.Arguments;
var projectSuite = objArgs(0);

for (i = 1; i < objArgs.length; i++)
{
if (objArgs(i).search(/\/testitemgroup:/i) != -1)
{
testItemGroup = objArgs(i).replace(/\/testitemgroup:/i, "");
}
if (objArgs(i).search(/\/p:/i) != -1)
{
project = objArgs(i).replace(/\/p:/i, "");
}

}


var tc = new ActiveXObject("TestComplete.TestCompleteX64Application.12");

var tci = tc.Integration;
tc.Visible = true;
tci.OpenProjectSuite(projectSuite);
ProjectTestItems = tci.TestSuite(project);
tci.RunProjectTestItem(project, testItemGroup);

 

 

and then calling this from a batch file:

 

Wscript.exe "C:\RunGroup.js" "\TestComplete\ProjectSuite\ProjectSuite.pjs" /r /p:TestRun001 /testitemgroup:Other /exit /silentmode
Exit

Does anybody know how to exit TestComplete in this scenario.

 

 

  • Hi,

     

    You are manually starting an instance of TestComplete as a COM object in your code. Started TC instance has no clue about parameters that were passed to the script file (RunGroup.js) used to instantiate it thus you must handle this in your code.

    https://support.smartbear.com/viewarticle/54655/ illustrates well what you need.

2 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    You are manually starting an instance of TestComplete as a COM object in your code. Started TC instance has no clue about parameters that were passed to the script file (RunGroup.js) used to instantiate it thus you must handle this in your code.

    https://support.smartbear.com/viewarticle/54655/ illustrates well what you need.