Forum Discussion

Pitney_Bowes_-_'s avatar
Pitney_Bowes_-_
New Contributor
14 years ago

Data Driven Test Loop



I am new to TestComplete 8 and have used it over
the last two months on and off because I am reviewing potential automation
software for QA.  I am having issues with a test case which has two Data
Driven Tests in a Loop.  The first one obtains an orderNumber and places
it within a text field in the application. Another screen appears after it is
successful and I have another Data Driven Test in a Loop which comes from the
Data Generator which (I would like to have insert each row of the table each
time it loops).  The issue is the first DDTL works very well, although the
second DDTL picks up the first row everytime.  



How do I configure the test case to have both DDTL to pick a unique row in
consecutive order?

8 Replies

  • Hi,


    It is difficult to understand what you need to do in the test. Could you please clarify the following:


    1. What should the test do?

    2. What does the clearpathOrderNumbers variable store?

    3. What does the dimensions variable store?


    Also, to help us find the solution to the problem faster, could you please send us your project along with the application under test?


  • 1. What should the test do?





    The test should simulate someone processing a piece of mail by scanning a barcode and then entering the dimensions of the package.





    The test inserts a 13 digit unique number 'CPORD03008079' to a text field within a screen from a .csv

    Then the test should insert the first line of data from the 99 line worksheet which was created from the Data Generator

    (although when the test loops it does use each line of data in the .csv, but only grabs the first line of data from the data generated worksheet on each loop.)





    So out of three testing loops, the orderNumbers would be different (and correctly so) although each orderNumber would have the same dimensions, since the loop is not moving to the next line of data in the data generated worksheet.





    2. What does the clearpathOrderNumbers variable store?

    It stores unique 13 digit alpha numberic characters which come from a .csv file





    3. What does the dimensions variable store?

    Weight, Length, Width, Height (whole numbers)





    Also, to help us find the solution to the problem faster, could you please send us your project along with the application under test?
  • Hi Douglas,


    I have explored your test, however, I could not run it, because you had not attached the tested application. Could you please send me the application?


    Meanwhile, I have noticed that Test2 contains two Data-Driven Loop operations, and the second one is the child of the first one. I recommend that you place these operations at the same level. To do this, select the second Data-Driven Loop operation in the test and click the Outdent Item button on the toolbar (see the attached image). This may solve the problem.

  • Included is the application.  I have also tried the second DDTL in different locations and each time I run the test, it stops on the last step before running the second DDTL, then fails.
  • Hi Douglas,


    I have modified your test and saved it as Test3. You can find the project with Test3 in the attached files.


    Your test should use only one data-driven loop (the order number should be used as a loop variable). To fill the Weight, Length, Width and Height fields in the application, you do not need to create one more data-driven loop. You can just create a new variable (I created the counter variable in Test3) that will count the loop iterations and use this variable to access different rows in the dimension variable for each loop.

  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 1 rankChampion Level 1
    Hi Douglas,



    I almost did not use keyword tests, so the idea might not work, but what if you create another keyword test that will include the second loop and all its children and then call this test from the first one?
  • Margaret



    Thank you so much for your help; your solution worked for me.



    Can you describe how to create a counter since I will be creating a few more tests with this type of scenario?
  • Hi Douglas,


    To count the loop iterations in your test, I created the counter keyword test variable. The type of the variable is Integer, the default value is 0. Then, I added the Run Code Snippet operation to the data driven loop. This operation contains the code that increments the value of the counter variable each time the loop executes:




    KeywordTests["Test3"]["Variables"]["counter"] = KeywordTests["Test3"]["Variables"]["counter"] + 1


    Since I have created the keyword test variable as a counter, this variable is available only from this test. However, you can create a project suite or project variable as a counter variable, and this variable will be available for all your tests in your project suite or project correspondingly. So, you can use the same variable in several tests.