Is it possible to use the data-driven properties in SilkCentral Test Manager to test all the methods for a particular test class?

0 Likes

Problem:

Is it possible to use the data-driven properties in SilkCentral Test Manager to test all the methods for a particular test class?

Resolution:

To use the data-driven properties available in SilkCentral Test Manager to test all the methods available for a test class we must provide a data-source that contains the information on the class we want to test and its methods. This data-source can simply be a Microsoft Excel file with two columns, one containing the class name the other the method to be tested:

excel sheet

After completing the Test Class and Methods list, save the file to your Source Control profile. Now under the "Administration" tree in SilkCentral Test Manager select "Configuration" and subsequently click the "Data Sources" tab. Click the "New Data Source" button to setup your Excel file as a Data Source.

data source

We can now proceed and create our JUnit test definition.

TD Create


TD Create 2

Now that the Test Definition is created we can now proceed with setting up the Data Driven properties for the JUnit Test Definition, click the edit button beside the Data-driven Properties section of your Test Definition:

DD props

Follow the workflow to setup your Data-driven properties, selecting your data-source and ensuring that you check:

  • Each data row is a single test definition
  • Enable data-driven properties
JUnit DS Properties Dlg

After clicking "Finish" SilkCentral Test Manage will enable the Data Driven properties and you will notice additional Test Definitions have been created for each row in you data-source. The below screen-shots demonstrates how your JUnit Test Definitions should look:

New TDs

TD Props

Under the "Data Set" tab you will find the list of elements that were present in your data-source. We will now use this information in this view to finish the data driven element of our Test Definitions. The column headers are the names by which we reference the elements in the "Data Set".

Col Head

In the above screen shot the column headers are "Junit_Class" and "Methods" and the information in these columns can be referenced by replacing properties in your Test Definition with:

  • ${Junit_Class}
  • ${Methods}

Using this information we can perform the final modifications to our Test Definition that will allow it to use the information in our data-source. Open up the JUnit properties dialog for the "junit.samples.VectorTest" Test Definition and edit the Test class and Test method properties to use the above references:

Final Props

Each child definition of the "junit.samples.Vector" Test Definition will now inherit the above properties and will also use correct corresponding row in your data-source when executed via SilkCentral Test Manager. Therefore you can test each method of a Test Class individually or them all by executing the parent Test Definition.



Old KB# 25026
Comment List
Related
Recommended