Forum Discussion

jeeejay's avatar
jeeejay
Contributor
13 years ago

Run options in TestExecute

Hello,



I was wondering why there is no way to only run a specific 'Test Item' declared in the project from TestExecute.



Please refer the attached image - I have a project suite with two projects which have two test items each. When I point to the Run menu option, a sub-menu appears where I can select which project to run but there are no sub-menus that show the respective Test Items.



Currenttly, I have to edit the project item in TestComplete on the development machine (by unchecking the remaining Test Items) and then copy over the updated file to the test machine. Or sometimes I create a batch file with the commad to run only the test item I am interested in. This is a little inconvenient.



It would be nice if someone could suggest any other possible easier way or it would be great to see that feature in the next version of TestExecute.



- GJ

7 Replies


  • Hello GJ,



    You can run a specific test item via COM. Here is a sample Windows Script Host script file that opens a specific project in TestExecute and runs a test item in it. Save the below code to a js file and run the file by double-clicking it in Windows Explorer:





    var projectSuite = "c:\\ProjectSuite\\ProjectSuite.pjs";

    var project = "Project";

    var testItem = "ProjectTestItem";





    try {

      var te = GetObject("", "TestExecute.TestExecuteApplication");

    }

    catch(e) {

      te = new ActiveXObject("TestExecute.TestExecuteApplication");

    }





    openProjectSuite(projectSuite);

    runTestItem(project, testItem);

    te.Quit();





    function openProjectSuite(projectSuitePath)

    {

      var integration = te.Integration;

      if (projectSuitePath != integration.ProjectSuiteFileName) {

        integration.CloseProjectSuite();

        integration.OpenProjectSuite(projectSuitePath);

      } 

    }





    function runTestItem(projectName, testItemName)

    {

      var integration = te.Integration;

      integration.RunProjectTestItem(projectName, testItemName);

      while (integration.IsRunning())

        WScript.sleep(100);

    }





    Also, we have a suggestion in our database to make it possible to run individual test items via the command line, and your request has increased its rating. Thank you.







  • Hi David,



    This is certainly a very creative way to run individual test items! I'll use it - Thanks.



    BTW - I am a little confused by the 'we have a suggestion in our database to make it possible to run individual test items via the command line' statement.



    Did you mean the 'Run' menu option? It is documented that individual test items can be run via command line.



    - GJ

  • Hello GJ,



    There is no way to run individual test items via the command line: there is a misprint in the TestExecute Command Line help topic, the correct text is (/project:project_name /test:test_name). So, you can run tests, not test items. We will correct the information.







  • Thanks for the confirmation David.



    It would be nice to see the option to run individual test items both through command line as well the the 'Run' option in the right-click context menu.



    Hoping to see a new minor release with these functionalities available soon.



    - GJ

  • Hello GJ,



    Running individual test items via the Run submenu will be impossible: as it is said in the Before Running Test Projects In TestExecute section of the Overview help topic, projects and project suites need to be prepared in TestComplete as TestExecute is just a player and does not allow to work with the internal structure of a project.







  • Hi,



    I was wondering if this has been fixed in the documentation?  The article here has a "/project: project_name /projectitem: item_name" line that may imply that a project can be followed by a test item on the TestExecute command line.