Data driven testcases
Creating Data Driven Testcases
5
To create a data driven testcase and run it using the
sample record
When you create a data driven testcase, one of the things that SilkTest does is to write a sample
record for each table. SilkTest does this by inserting a value from the original testcase into the sample
record. You can then use the sample record to run a quick test of your data driven testcase or to verify
your DSN connection.
The goal of this exercise is for you to use the Data Driven Workflow to create a data driven testcase
and to run that testcase using the sample record.
Step 1: Create a data driven testcase
1 Open the GMO application at
http://demo.borland.com/gmopost/
2 Start SilkTest and click File/Open. Browse to <SilkTest installation directory>/examples and
open usability.t.
3 Turn on the Data Driven Workflow bar (if it's not already visible) by clicking Workflows/Data
Driven. On the Data Driven Workflow bar, click Data Drive Testcase. On the Select Testcase
dialog, double click testcase1.
4 On the Specify Data Driven Script dialog, click Create a new file/Overwrite an existing file and
browse to the <SilkTest installation directory>/examples directory. Give the file the name
gentest1, which means you will have to change the default new name.
5 Click Save to save the new file and then click OK when you return to the Specify Data Driven
Script dialog. SilkTest automatically applies the .g.t file extension to that file.
6 On the Select Data Source dialog you tell SilkTest the location of the database you are using to
supply values for the data driven testcase. Accept the default data source, Segue DDA Excel.
At the Select Workbook field, click Browse and select the <SilkTest installation
directory>/examples/TestExcel.xls and click Open. Click OK on the Select Data Source dialog.
7 On the Specify Data Driven Testcase dialog, click OK to indicate that you want to add a new
testcase named DD_testcase1 to the gentest1.g.t file you created in Step #3.
8 The Find/Replace Values dialog appears; close this dialog because you are not using it for this
exercise. SilkTest loads the database tables and columns and then displays the gentest1.g.t file
in the 4Test Editor.
If you're familiar with the 4Test Editor, you'll notice some changes for example, there's a Find
and Replace resizable menu bar that appears at the top of the 4Test Editor.
You'll notice that there is a section at the top of your file that is collapsed; it contains the code
that SilkTest writes including the DSN connection, a sample record, and other necessary
information:
[+] // *** DATA DRIVEN ASSISTANT Section (!! DO NOT REMOVE !!) ***
To see the code that SilkTest creates, click [+] to expand that section. Do NOT edit any of the
information contained in this section.