Forum Discussion

abhibajare's avatar
abhibajare
New Contributor
14 years ago

How to use Data Driven loop for multiple Excel Sheet?

Hi,

I am using Test Complete to automate a test case.



Test steps are as follows:

1) Open application

2) Select a range[1-10, 1-50, 1-100 etc] from a combo-box.

3) Enter a number in a textbox.

4) Click on Apply button to verify whether input is valid or not.



I have a Excel WorkBook containing numbers to be tested for each range specified in separate WorkSheet. Now, I want to add a Data Driven Loop to fetch these input numbers for selected range from separate sheet.



Here, I can use Data Driven Loop to fetch input numbers from 1 worksheet, but for next range, I can't use next sheet for same Data Driven Loop.

5 Replies

  • abhibajare's avatar
    abhibajare
    New Contributor
    If I create separate Data Driven for each sheet, then I will have copy and paste all steps that should be performed inside Data Driven loop. This is not a good practice. If, in future, I have to modify a step inside Data Driven Loop, I will have to make changes in all instances of Data Driven Loop. If you know some solution, would it be possible for you to post a small algorithm for doing same?



    Thanks in advance!
  • Hi,



    In this case, keep all your test data in a single sheet because DDT drivers and loops work with a single sheet. As an alternative, read your Excel files via COM which allows you to access data in them from any sheet at any moment of time, but this will require writting a script function. For example.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    In the SQAForums thread, I give a suggestion of how you can use two DDT drivers without needing to re-create all your code to be executed.



    But, as noted, a best practice is to keep everything you want to execute in a single sheet.



    Out of curiousity, in case there is some other purpose and possibly a different solution for you, why is your data on two different sheets rather than on a single sheet?
  • sam_kvale's avatar
    sam_kvale
    Occasional Contributor
    I am having a similar problem.

    Did this topic ever get resolved into a solution that works for you?