Forum Discussion

JP_603's avatar
JP_603
Occasional Contributor
9 years ago
Solved

Data Drive testing over test sequence

Is it possible to do a data driven test over a sequence of tests? By that I mean can one row of a csv file be used to go through each test in the sequence using the data in each test and then loop back to the first test to start with the next row.

 

For example if I have one test that just opens the application and logs in with a username and password provided by the csv file. Then go to another test that opens a form and fills in information provided by the same csv file followed by a third test that logs off and closes the application. After that I want it to loop back to the first test and log in with the info in the second row of the csv.

 

I'm trying to accomplish something much more detailed then this example but this gives the basic idea of what I'm hoping to do.

  • Yes.

     

    I do pretty much exactly this using Excel via COM.

     

    I don't use the in-built DDT object as I found it too limiting for what I wanted. I have my own set of custom script extensions that act as a framework and work through lists of tests/test steps/test data contained in one or more Excel sheets.

     

    Each line on the spreadsheet contains:

     

    A run flag (ie - run this line or not)

    A timestamp (which will be filled in as and when the line is run)

    A result (which will be filled in as and when the line is run)

    The name of the test function to call. (All functions in use must be known - ie. USEUNIT - to the "driver" function that controls all this)

    A number of parameters (data) to pass into the function. Can to zero to many.

    A number of expected results (data) for the function to check against. Can be zero to many.

    (Optional) A reference to a data file if there is too much data for a single Excel cell. If present, file will be read and the data passed to the function/test.

    (Optional) A marker. Can be referred to by susequent lines to check if a prior test/step passed to failed.

    (Optional) A lookup. Checks the status of a marker line (see above) to determine whether a line should be run or not based on the result of the lookup.

     

    This all produces an output/results sheet. (There is also an associated log file which writes out in far more detail exactly what the test is doing.)

     

    Once all tests are run, it then collates a summary results sheet of all tests. This is saved along with the individual results. It can also (optionally - it's a config setting) be mailed to specific mailing list and also write out an HTML summary which can be accessed via the build page or internally via our intranet.

     

    These are all custome build script extension functions to the TestComplete IDE. They form our testing framework. All you then need to do is write and docuement new functions as required. And then use those as and where required by filling in the test details on spreadsheet(s).

3 Replies

  • Yes.

     

    I do pretty much exactly this using Excel via COM.

     

    I don't use the in-built DDT object as I found it too limiting for what I wanted. I have my own set of custom script extensions that act as a framework and work through lists of tests/test steps/test data contained in one or more Excel sheets.

     

    Each line on the spreadsheet contains:

     

    A run flag (ie - run this line or not)

    A timestamp (which will be filled in as and when the line is run)

    A result (which will be filled in as and when the line is run)

    The name of the test function to call. (All functions in use must be known - ie. USEUNIT - to the "driver" function that controls all this)

    A number of parameters (data) to pass into the function. Can to zero to many.

    A number of expected results (data) for the function to check against. Can be zero to many.

    (Optional) A reference to a data file if there is too much data for a single Excel cell. If present, file will be read and the data passed to the function/test.

    (Optional) A marker. Can be referred to by susequent lines to check if a prior test/step passed to failed.

    (Optional) A lookup. Checks the status of a marker line (see above) to determine whether a line should be run or not based on the result of the lookup.

     

    This all produces an output/results sheet. (There is also an associated log file which writes out in far more detail exactly what the test is doing.)

     

    Once all tests are run, it then collates a summary results sheet of all tests. This is saved along with the individual results. It can also (optionally - it's a config setting) be mailed to specific mailing list and also write out an HTML summary which can be accessed via the build page or internally via our intranet.

     

    These are all custome build script extension functions to the TestComplete IDE. They form our testing framework. All you then need to do is write and docuement new functions as required. And then use those as and where required by filling in the test details on spreadsheet(s).

    • JP_603's avatar
      JP_603
      Occasional Contributor

      Thank you for the reply Colin.

       

      I'm new to Test Complete so I just want to make sure I'm understanding what you are saying. So you have a custom script in Test Complete that reads the Excel file via COM and based on each line of the spreadsheet it runs specific tests that could be scripted or keyword tests correct? Additional data is passed to each individual test based on the rest of the data on the same line? This additional data could be data for the test or just a call to another data file like another spreadsheet that contains the data needed for that test?

       

      If all of that is correct my last question would be if I have a keyword test with it's own data driven loop and call it from the custom script will it still execute the data driven loop?

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        To answer both parts ....

         

        In a nutshell, yes. Thats pretty much it. But they are script extensions to TestComplete itself rather than a script unit you load and run. (See: https://support.smartbear.com/viewarticle/69987/ )

         

        and ...

         

        No idea! I've never used the keyword test functionality in TestComplete. I've used scripting from the word go.