Ask a Question

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

SOLVED
MegO
Contributor

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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
AlexKaras
Community Hero

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

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.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

2 REPLIES 2
AlexKaras
Community Hero

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

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.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

MegO
Contributor

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

Thank you Alex 🙂

cancel
Showing results for 
Search instead for 
Did you mean: