Accessing external data from the test

Setting up a data-driven test to accept data from an external text file.

You will now adapt the same test performed in the previous lesson to allow an external text file to serve as the data source.

  1. In the My data-driven tests test module you created previously, create a new test case:

    1. Place your cell pointer on a line somewhere below the existing set of action lines (but before the FINAL section, if any).

    2. Click Create New Test Case on the toolbar.

      A test case line similar to the following is inserted.

    3. In the second column of the new line, assign the test case an ID of TC 02(if not already set to that value).

    4. Press Tab to advance to the next column, and provide a description for your test case, such as Report data from an external source.

  2. Select the three action lines from the previous test case (TC 01), and copy them. Do not include the test case line.

  3. Place your cursor in the first column, five or more lines below your new test case line, and paste the text.

  4. Now you will modify this sequence of action lines to switch data sources:

    1. In the space between the test case heading and the use data set action line, enter the action refill data set. This is the action that connects with the data file.

    2. With the cell pointer in the adjacent cell (data set), press the Spacebar and select /Rented Cars file link, the dummy data set you created earlier.

    3. The next cell, text file, is where you specify the location and name of the text file that will serve as the data source.

      Tip:
      Note that, if you are working on a Windows system, you have the option of using either forward or backward slashes ( / or \ ) as folder/subfolder delimiters.

    4. Finally, modify the name argument of the next action line so that use data set also points to the /Rented Cars file link data set.

You have completed the steps required to have a data-driven test change its data source from a data set to external text file. Your test sequence for this example should appear similar to the following:

Next, you will run the test and confirm that the data from the external file is properly read.


Copyright © 2024 LogiGear Corporation. All rights reserved. LogiGear is a registered trademark, and Action Based Testing and TestArchitect are trademarks of LogiGear Corporation. All other trademarks contained herein are the property of their respective owners.

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1 (650) 572-1400