Forum Discussion

svaze74_1's avatar
svaze74_1
Contributor
11 years ago

Cannot run particular Project Test Item using commandline TestExecute?

Hi,

Why can't we run particular project test item using commandline TestExecute?
For Ex- I have created folders for test suites on Projects Test Items page.
I want to execute those individual test suites via command line using TestExecute.
Although mentioned on page http://support.smartbear.com/viewarticle/26413/?_ga=1.144875186.745138936.1385364668 its not working.

Thanks,
Shrirang

5 Replies

  • jkrolczy's avatar
    jkrolczy
    Regular Contributor
    I have use the below to run specific test groups

    and it works.



    This is an old article from old SQAForum website.



    Software Quality Assurance Forums: Management of tests group run



    It does work.

    You need to modify below for TC9 use.



    JamesK.



    ==================





    Management of tests group run #669502





    Hi,

    I am using TC-8.2 and TE-8.2. In one project suite, I have many tests.

    I used to organize the sequence of them by editing project items.

    I made some groups and would like to run exactly group on demand.

    For example, on TC all groups are enabled. I need to run second or third group.



    start /wait "TestExecute" "C:\Program Files (x86)\Automated QA\TestExecute 8\Bin\TestExecute.exe" "path\ProjectSuite.pjs" /run /project:new projectitem:3_group



    3_group is the name of project test item group



    It would be nice to get any suggestion, doesn’t matter test complete or test execute.

    This parts works fine:



    start /wait "TestExecute" "C:\Program Files (x86)\Automated QA\TestExecute 8\Bin\TestExecute.exe" "path\ProjectSuite.pjs" /run /project:new



    but every time I need to make changes and save them on TC or to modify manually project.mds file.

    I think it should be more attractive way to do this.



    Thanks,

    Kristina





    ====



    Hi Kristina,



    We have a suggestion in our DB to implement the ability to execute test items provided by the

    specified group via the command line.

    Your post has increased its rating. Thank you.



    At the moment, you can accomplish your task in the following way:



    1. Create a "launcher.js" file with the following contents:

    Code:

    --------------------------------------------------------------------------------



    var objArgs = WScript.Arguments;

    var app = objArgs(0);

    var projectName = objArgs(1);

    var itemOrGroup = objArgs(2);

    var productsRunning = false;



    if(!CheckForInstance("TestComplete.TestCompleteApp lication.8") && !CheckForInstance("TestExecute.TestExecuteApplicat ion.8"))

    {

    switch (app)

    {

    case "TC":

    var appName = "TestComplete.TestCompleteApplication.8";

    if(!CheckForInstance(appName))

    {

    var comObj = new ActiveXObject("TestComplete.TestCompleteApplicatio n.8");

    }

    break;

    case "TE":

    var appName = "TestExecute.TestExecuteApplication.8";

    if(!CheckForInstance(appName))

    {

    var comObj = new ActiveXObject(appName);

    }

    break;

    default:

    Stop("Incorrect application. Exiting...");

    }

    }

    else

    {

    Stop("TC or TE is already running. Exiting...");

    }

    var iObject = comObj.Integration;

    // Specify the path to your project suite; backslashes are doubled

    iObject.OpenProjectSuite("path\\ProjectSuite.pjs") ;

    iObject.RunProjectTestItem(projectName, itemOrGroup);

    while(iObject.IsRunning())

    {

    WScript.Sleep(100);

    }

    comObj.Quit();

    WScript.Sleep(15000);



    function CheckForInstance(ObjectName)

    {

    try

    {

    var AppObject = GetObject("", ObjectName);

    return true;

    }

    catch(e)

    {

    return false;

    }

    }



    function Stop(message)

    {

    WScript.Echo(message);

    WScript.Quit(1);

    }



    --------------------------------------------------------------------------------





    2. Make the command in your batch file look like this:

    Code:

    --------------------------------------------------------------------------------



    start /wait launcher.js "TC" "new" "3_group"



    --------------------------------------------------------------------------------



    and execute the batch file.



    Note that you can use the following command to run tests using TestExecute:

    Code:

    --------------------------------------------------------------------------------



    start /wait launcher.js "TE" "new" "3_group"



    --------------------------------------------------------------------------------





    --------------------

    Regards,

    Allen - SmartBear Support





    ===



    Hi Allen,



    Thank you very much, it really works and helped me so much.
  • simon_glet's avatar
    simon_glet
    Regular Contributor
    Hi Shrirang,



    As the command line works fine, could you post the command line that fails ?



    Sincerely
  • Hi Simon,

    Here is the command line that fails.

    ( "C:\Program Files (x86)\SmartBear\TestExecute 9\Bin\TestExecute.exe" "D:\MaxSql_TestAutomation\TestComplete_ForMaxSqlDesktop\trunk\TC_Automation_Project\TC Automation Project\MaxSql-ARRA-Automation.pjs" /r /p:MaxSql-ARRA-Automation /pi:eFiles /e )

    "eFiles" is a folder created on Test Items Editor page of Project Properties page.

    Kindly confirm that we can execute tests in folders on test items page. If yes, how to do it.

    Thanks,
    Shrirang
  • When I try to run this command line, it throws the message as shown in attached screenshot.

    Thanks again.
    Shrirang
  • Thanks for the info. It helped a lot!.
    The commandline works fine after making a minor change.
    It does not need "/" character before projectitem:name.

    This needs to be changed from smartbear site documentation as well !!

    Thanks,
    Shrirang