Created On:  04 October 2010


How do I configure a Data Driven SilkTest Script to accept parameters from SilkCentral Test Manager at runtime?


A common misconception of running data-driven scripts from SilkCentral Test Manager is that you need to create a Data Driven script in SilkTest, and upload this to Test Manager to be executed. However at runtime SilkCentral recognises the '.g.t' extension of a data driven SilkTest script, and passes complete control over to SilkTest. No data is passed to the testcase from SilkCentral; because data driven SilkTest scripts have their own data source hard-coded in the script itself, and this cannot be overwritten.

If the idea is to pass parameters directly from a data file in SilkCentral Test Manager, to the testcase at runtime, you must use a standard SilkTest script with the '.t' extension. You will not need to include code in the script to open and read from the data file since these parameters will be replaced automatically for each execution. For Example: consider that your testcase needs to accept parameters Firstname and Lastname. The testcase definition is modified as follows:

  testcase DataDrivenTest(String sLastName, sFirstName)

  [ ] MyApplication.SetActive()
     [ ] MyApplication.Control.Listbox.Pick()
     [ ] Listbox1.SetActive()
     [ ] Listbox1.SetText(sLastName)
     [ ] Listbox2.SetActive()
     [ ]Listbox2.SetText(sFirstName)
     // Rest of Testcase statements go here

You want to pass these from the following Excel Data file - which has already been added to the project as a Data Source:

The 'Test Data' field in the 'Silk Test - Test Properties' dialog, is where we configure Test Manager to pass the contents of the data file to the testcase. This dialog is displayed during the process of setting up a new SilkTest test definition; and parameter values are mapped to the column header names in the Data file using the syntax: '${ParameterName}. 

In this example; the parameters would be mapped to the column headers as follows:

Incident #2429113