Forum Discussion

Hardy's avatar
Hardy
Occasional Contributor
8 years ago
Solved

how to continue to next Data-Driven loop item on error

Now i am testing a windows application, record the create new customer operation, need to read data from excel and enter the input fields. And i am using the Data Driven Loop to run multiple test cases, TestComplete will stop on error if there exists error, so i want to know how to continue to next Data-Driven Loop item.

9 Replies

  • shankar_r's avatar
    shankar_r
    Community Hero

    Under the 'Tools > Current Project Properties' menu,

    click on 'Playback' in the left navigation

    uncheck the 'Stop on Error' checkbox under the 'Runtime' section. 

     

    Then it will display the error in Log and will move to next test item.

    • Hardy's avatar
      Hardy
      Occasional Contributor

      Hi Shankar R,

       

      Thanks for your reply, but my question is how to move to next Data-Driven Loop item, if there any one step under Data-Driven Loop failure, i want to skip the rest steps and move to next Data-Driven Loop item.

       

      Thanks

      • shankar_r's avatar
        shankar_r
        Community Hero

        If you are using Script data-driven loop then you can use try catch to ignore the current iteration error like below,

         

        For example:

         

        function Main()
        {
            Driver = DDT.ExcelDriver("../../TestBook.xlsx", "TestSheet", true)
            TestedApps.RunAll(); 
            orders = Aliases.Orders;
            mainForm = orders.MainForm;
            while(!Driver.EOF())
            {
              try
              {
              OpenForm();
              orderForm = orders.OrderForm;
              groupBox = orderForm.Group;
              PopulateForm();
              Checkpoint();
              CloseForm();
              }
             catch(ex)
             {
              Log.Error("Error in loop");
             }
        
              Driver.Next();
            }
            CloseApplication();
        }