Posted by Alex Kuzin on Friday, March 19, 2010

It is now even easier to create data-driven tests with TestComplete 8. Data-driven tests usually consist of the following actions:

  • Connects to a data storage (for instance, to an Excel sheet).
  • Iterates through the rows of the storage.
  • Uses data from each row to simulate user actions over the tested application.

Though previous versions of TestComplete included special features for connecting to data storages and retrieving data from them, you had to implement the iteration yourself. Also, you had to modify parameters of test commands so that they used values of the current data row.

TestComplete 8 includes three new enhancements that make the creation of data-driven tests a lot easier:

  • DB Table variable type.
  • Data-Driven Loop operation.
  • Make Data Loop command.

DB Table Variables

The DB Table variable is a new type of project, project suite or keyword test variables. The DB Table variable provides a connection to an external data source and contains specific methods and properties that provide forward read-only access to data rows. Using these variables, you can easily retrieve data from Excel sheets, database tables or queries and CSV (comma-separated values) files.

Data-Driven Loop Operation

A new Data-Driven Loop operation is used to implement data-driven functionality in your keyword tests. The operation uses a DB Table variable to connect to external data storages and iterate through their rows. For each row, the operation executes child operations (these child operations, for instance, can simulate user actions over the tested application according to the data stored in the current data row).

Make Data Loop Command

You can add the operation to your test the same way you add other operations, or you can add the operation by using the new Make Data Loop command of the keyword test editor’s context menu. This command makes the creation of data-driven tests as easy as 1-2-3:

  1. Record test commands that will simulate user actions over your tested application.

  2. In the keyword test editor, select the operations that you would like to add to the data-driven test. Then right-click the selection and choose Make Data Loop from the context menu.

    The Make Data Loop command

  3. This will invoke the Data-Driven Loop wizard.

    On the first page of the wizard, you specify a new or existing DB Table variable that will be used to retrieve data from an external data storage (Excel sheet, database table or CSV file).

    The Select Database Variable page

    If you chose to create a new variable, then on the next pages you specify the data storage type and the storage file:

    The Specify Data Source Type page

    Then you can specify which rows to be retrieved from the data storage. The Data-Driven Loop operation will iterate through these rows:

    The Select Records page

    On the last page of the wizard, you can easily view the recorded (or hard-coded) values of operation parameters with data retrieved from the data storage:

    The Update Values page

    If you want an operation to use the recorded values, leave [Use hard-coded value] for its parameters.

    After you click Finish, TestComplete will add the Data-Driven Loop operation to your test, make the selected operation child operation of this Data-Driven Loop operation and, finally, update the parameters of the moved operations with the values specified in the Data-Driven Loop wizard.

    The updated test

 
As you can see, creation of a data-driven test includes only 3 steps:

  1. Recording the needed test operations.

  2. Choosing the Make Data Loop command.

  3. Specifying the parameter values in the wizard.

These all simplify and speed up the creation of data-driven tests. We hope you enjoy these new improvements and if your haven’t tried them in TestComplete 8 Beta, you can apply for the Beta version.

Share this blog post:
  • Facebook
  • DZone It!
  • Digg It!
  • Del.icio.us
  • Reddit
  • Twitter
  • Email It!

Comments  8

Gravatar
  • Carsten 03/24/2010 05:35 AM

    Alex,

    thanks for the post.

    I like it a lot, that TC introduces more time saving features. More of "we help you doing it" and less "you can do anything, but you will have to do it yourself...".

    Since I try to get around with keyword tests and a few code snippets here and there it's great to see it supported by keyword tests!

    Looking forward to my first data driven test!

     
    Gravatar
  • Alex 03/25/2010 03:22 AM

    Hi Carstein,

    Thank you for your feedback.
    Please don't hesitate to share your opinion and send suggestions to our support team after you try TestComplete 8. :-)

     
    Gravatar
  • Veronica 06/02/2010 07:04 AM

    Hi!  We are pretty excited about the new rollout of TC 8.  We use Excel worksheets w/ all of our tests and wondered if it would still be useful if we were not using the Keyword testing. Our scripts are more VB based.  Also, all of our paramenter values are held within the Excel worksheet.  It appears from the description that this is exactly what we need but wanted to make sure.

    Thanks!!!  Veronica

     
    Gravatar
  • Alex 06/03/2010 22:29 PM

    Hi Veronica,

    The described operation and menu command are new features. They do not substitute the existing functionality. So, your TestComplete VBScript routines will work as they did in previous versions. You may consider using the new functionality when creating new data-driven tests.

    Best Regards,
    Alex

     
    Gravatar
  • Shabeer 01/04/2011 02:06 AM

    All the demos I have seen are using keyword test. It would be very nice and helpful if you started giving demos and tutorials using scriting (jscript, C# script)

     
    Gravatar
  • Alex 01/09/2011 21:57 PM

    Hi Shabeer,

    We use keyword tests, because they are easier to understand, and most novice users prefer them to scripts.

    TestComplete's help system includes a tutorial that demonstrates data-driven testing with scripts (all supported languages):
    http://www.automatedqa.com/support/viewarticle/11891/

    For a video demonstration, check out the webinar recording:
    http://www.automatedqa.com/videos/data-driven-testing-testcomplete-webinar/

    It was recorded for TestComplete 7.0, but all the objects, features and functionality are supported by TestComplete version 8 in the same manner.

    Best regards,
    Alex

     
    Gravatar
  • chandra 01/11/2011 16:18 PM

        Hi All

    I can't see the option "Make Data Loop" after rightClicking. please help me

    Thanks
    Chandra

     
    Gravatar
  • Alex 01/11/2011 16:51 PM

    Hi Chandra,

    What version of TestComplete do you use? The described functionality is available in TestComplete 8 and later.

    If this is the version you have, then it seems something has gone wrong on your PC. Please send a request to the Support Team: http://www.automatedqa.com/support/message/.

    Best regards,
    Alex

     

    Leave a comment:

    1.