Forum Discussion

Taegost's avatar
Taegost
New Contributor
14 years ago

Is it possible to use a .csv file to store expected results?

I am trying to set up automated testing for a very complicated, dynamic database program.  What I'm trying to do is instead of storing the expected results of a particular checkpoint within TestComplete itself, I would like it to pull that data from a .csv file instead.  I can run reports within the main application and export that data to a spreadsheet before each automated test, and would like to be able to use the output of those reports to verify that the data is pulled and displayed properly in the web extension we're using TestComplete on.

Is something like this possible?  and if so, how would I set it up in TestComplete?

3 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor

    What you are asking about is Data-driven testing.


    You can read a general explanation here (there you will find the section "Using CSV files as data storage", this is exactly what you need).

  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Michael,


    Gennadiy is right. You can easily obtain the data stored in the CSV file from test and then compare the data generated by your reports equal to the file's contents. To obtain the exact value stored in the file from script, you can use CSVDriver:



    Set Driver = DDT.CSVDriver("C:\MyFile.txt")

    DDT.CurrentDriver.Value(i)


    You can also obtain the values stored in the CSV file from a keyword test. For this purpose, use the Data-Driven Loop operation.


    Below, are some links that will help you get started:

    1. Reading Data From External Files

    Describes how you can read data from external files with TestComplete.

    2. CSV Variables

    Describes the CSV variables that let you retrieve data from CSV files and save it to a TestComplete project.

    3. DDT.CSVDriver

    Describes the CSVDriver method.

    4. Data-Driven Loop operation

    Describes the Data-Driven Loop operation.

    5. Data-Driven Testing With Scripts - Tutorial

    Contains a data-driven testing tutorial (for scripts).

    6. Data-Driven Testing With Keyword Tests - Tutorial

    Contains a data-driven testing tutorial (for keyword tests).

  • Taegost's avatar
    Taegost
    New Contributor
    Thank you for the links, I've been able to find a lot of information on using a CSV file to input the data, but not much for verification of the data.  These point me in the right direction, I appreciate your help!