How to create SilkTest Test Definitions in SilkCentral Test Manager that take arguments

0 Likes

Problem:

How to create SilkTest Test Definitions in SilkCentral Test Manager that take arguments

Resolution:

Data-driven tests are tests that are derived from values in an existing data source, such as a spreadsheet or a database.

In SilkCentral there are two ways of executing data-driven tests.

  • SilkTest Data-driven tests (.g.t)


These are SilkTest scripts that have been data-driven and now have an extension of ???.g.t???.

  • SilkTest Testcases that take arguments

These are SilkTest testcases that take arguments. SilkCentral Test Manager can pass the arguments to the Testcase from a configured data source.

We have SilkTest testcases that takes 2 arguments. SilkCentral Test Manager will pass the arguments to the testcase from our configured data source. In our testcase we see that testcase GetUserDetails takes 2 string arguments.

testcase GetUserDetails (string sName, string sAddress) appstate none
print (sName " lives in " sAddress)


We will need a data source to be created in SilkCentral Test Manager that will be able to pass in the sName and sAddress arguments into the SilkTest scripts.


A. Procedure to configure a Microsoft Excel or CSV data source:

We need to create a data source that contains the values that will be passed into the testcase ???GetUserDetails??? above. In this example we are using an excel document. Note the column headers are ???Name??? and ???Address???




Now we need to create a Data Source in SilkCentral Test manager.
see Knowledge Base (KB) article How to create a Data Source in SilkCentral Test manager .

Note To make SilkCentral aware of changes in your data source, you must synchronize your data source profile with your data source whenever your data source is updated or changed.

see Knowledge Base (KB) article How to make SilkCentral Test Manager aware of changes in your data source .


B. Creating data-driven test definitions

1. Create a new test definition using the SilkTest script we created earlier.

2. Choose the testcase we created earlier and within the ???Test data??? field enter the parameters that are going to be passed into the testcase as arguments. Note that the test data values have the same name as the excel data sources column headers. Parameters are comma separated.


The following parameter notations are supported for SilkTest tests:

${}


3. Do not check ???Data driven??? as in this instance SilkCentral Test Manger is data driving the script and not SilkTest. Click ???Finish??? to complete the task.

4. Go to the ???Data-driven Properties ??? section at the bottom of the newly created test definition Properties tab and select the Edit icon to open the Data-driven Properties dialog.

5. Select the pre-configured data source from the ???Data Source??? drop-down list box we created earlier (UserDetails).

6. Click ???Next??? to continue.

7. Select a data set from the ???Data set??? drop-down list box (in the case of Excel data sources, this is a worksheet name. In the case of database data sources, this is a table name).



8. Select the ???Each data row is a single test definition checkbox??? to have each row in your data set considered to be a separate test definition, or do not check this checkbox to create a single test definition for all data rows of your data set. See ???Single vs. multiple data-driven test definition instances??? below for details.

9. (optional) You can enter a SQL query into the Filter query field to filter your data set based on a SQL-syntax query.

10. Select the ???Enable data-driven properties??? checkbox to enable data-driven functionality and click ???Finish??? to save your settings.

Note Data-driven property settings are visible in the lower portion of each test definition???s Properties tab.


Now that the test definition is data driven and we choose ???Each data row is a single test definition??? a test definition will be created for each row in the excel sheet.


Each test definition will be getting the parameters from the data source passed into their SilkTest testcase.



Old KB# 25123
Comment List
Related
Recommended