Forum Discussion

obaid_shirwani's avatar
obaid_shirwani
Contributor
9 years ago
Solved

Executing Test Group using command prompt

Hi folks,

 

I am facing an issue while executing a Test Group using command prompt.

 

I have a project which has three Test Groups having sub-folders with TestSteps in it. View image: TestGroups.png

 

I have to launch TestComplete using command prompt and execute anyone of these Test Groups at a time.

 

I am using the following two approaches:

 

1. Using command prompt directly and executing the following command to launch and execute the SECOND Test Group:

 

"C:\Program Files (x86)\SmartBear\TestComplete 10\Bin\TestComplete.exe" "D:\GitShared\qatestautomation\eWorkspace\IbexAutomation\IBEXGlobal\IBEXGlobal.pjs" /r /project:Portal /testitemgroup:"USPayroll"

 

This launches TestComplete successfully. However, it executes the first Test Group instead of the mentioned Second Test Group. I have to manually disable the first Test Group in order to launch the second Test Group. 

 

What am I missing here?

 

2. Using ActiveX to do the same as above:

 

The second approach is about launching TestComplete using ActiveX and executing the above, using a JS file. However, I am getting an message.

 

The JS file contents are:

http://support.smartbear.com/viewarticle/54654/

 

// 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, "");
}
if (objArgs(i).search(/\/project:/i) != -1)
{
project = objArgs(i).replace(/\/project:/i, "");
}
if (objArgs(i).search(/\/project:/i) != -1)
{
project = objArgs(i).replace(/\/project:/i, "");
}
}

var tc = new ActiveXObject("TestComplete.TestCompleteApplication.10");

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

 

//End of File

 

I am using the following command to launch this JS file:

 

"D:\GitShared\qatestautomation\eWorkspace\IbexAutomation\IBEXGlobal\RunTestItemGroup.js" "D:\GitShared\qatestautomation\eWorkspace\IbexAutomation\IBEXGlobal\IBEXGlobal.pjs" /p:Portal /testitemgroup:"USPayroll"

 

Executing this is giving me the following error message: View image: Error.png

 

What is missing here.

 

Help needed.

 

Regards,

 

OS

 

 

 

 

 

  • AlexKaras's avatar
    AlexKaras
    9 years ago

    Hi,

     

    > Here in this article Run the specified group of test items via TestComplete's command line TestComplete mentions of "/testitemgroup"

     

    The referenced article mentions /testitemgroup as the parameter for the RunTestItemGroup.js (or RunTestItemGroup.vbs) script, but not TestComplete's command line like in your first approach.

    The only possible way now to execute test item from the command line is either to use the script referenced by you and me or to create an application that will drive TestComplete using COM.

9 Replies

  • Adding to it: The JS file gives error message on this line of code:

     

    var tc = new ActiveXObject("TestComplete.TestCompleteApplication.10");

     

     

     

    • joseph_michaud's avatar
      joseph_michaud
      Moderator

      > The requested operation requires elevation.

       

      Offhand, I'd say that you need more privileges.  Try running as Administrator.

      • obaid_shirwani's avatar
        obaid_shirwani
        Contributor

        I know that I need to run the JS file as Administrator ... How?

    • tbeg's avatar
      tbeg
      New Contributor

      To not have the error "The resquested operation requires elevation" in the script when you create ActiveXObject,

      In the file C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\TestComplete.exe.manifest, you have to remvove :

      - uiAccess="true" ( from : <requestedExecutionLevel level="asInvoker" uiAccess="true"/>)

      Source : https://support.smartbear.com/viewarticle/78195/