Forum Discussion

chicks's avatar
chicks
Regular Contributor
13 years ago

Accessing values in Test Item page

My understanding is that I can run either a project or a single test item from the command line. However, I can't run a group item from the command line.   So,  I end up writing a function corresponding to my Group item which essentially just lists the items in the group item separately.



e.g. 



function run_webServiceTests_withBrowser() {

   runTest( wsTest_addCardLater, " WS - add Card Later");

   runTest( wsTest_sendMeACard, "WS - Send me a card");

   runTest( drive_WS_signupWithCard, "WS - Signup with cards");

   runTest( wsTest_singleStep_SignupNoCard, "WS - Single Signup - No Cards");

   runTest( wsTest_singleStep_Signup_WithCard, "WS - Single Signup - With Cards");

   runTest( wsTest_adminPortal_signup_WithCard, "WS - Admin Portal Registration - With Cards");

}



So, my actual question is:  Is there an easy way to  grab the test item names and function calls from the project file, so that I don't end up manually retyping this information ?   I know that it's in the .mds file but not simply enough to parse out.



Thanks,  Curt Hicks
  • chicks's avatar
    chicks
    Regular Contributor
    For anyone else who's curious, here's the response I got from the support team.

    I haven't experimented with it yet..

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



    Here's a sample solution:

     

    1. Create a RunTestItemGroup.js file with the following contents:

     

    // JScript

     

    var testItemGroup, project;

     

    var projectSuite = objArgs(0);

    var objArgs = WScript.Arguments;

     

    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.9");

     

    var tci = tc.Integration;

    tc.Visible = true;

    tci.OpenProjectSuite(projectSuite);

    ProjectTestItems = tci.TestSuite(project); tci.RunProjectTestItem(project, testItemGroup);

     

    2. To open a TestComplete project and run a group of test items, run the RunTestItemGroup.js script with the appropriate command-line arguments, e.g. the following command line will open the "C:\Users\mike\Documents\TestComplete 9 Projects\TestProject81\TestProject81.pjs" project suite in TestComplete 9 and execute the Group1 test items group in the TestProject81 project:

     

    RunTestItemGroup.js "C:\Users\mike\Documents\TestComplete 9 Projects\TestProject81\TestProject81.pjs" /p:TestProject81 /testitemgroup:Group1

     

    BTW, to learn about the logic of the external RunTestItemGroup.js script, please refer to the "Working With TestComplete via COM - Overview" help topic (http://support.smartbear.com/viewarticle/33145/) and those related.

     

  • chicks's avatar
    chicks
    Regular Contributor
    Thanks Tanya!  I've submitted a support request.  Regards,  Curt