-
Notifications
You must be signed in to change notification settings - Fork 0
Data Driving Tests
One of the goals of the automation system is to minimize test script maintenance. To help in achieving that goal test script and test environment configuration has been abstracted and resides in an INI type file that is read by the test system at test execution time. The format of this file is a simple [section] followed by setting=value pairs. Below is a sample file as well as format:
The above is accomplished by integrating a handy Perl module called Config-Tiny which gives you the capability of managing any type of configuration file. In our case we are managing test script configuration files.
The main advantage of this level of abstraction at the test script configuration level is the capability gained of being able to control not only the environment which the test will be executed against, but also the data it will use. As well, we can make our test scripts even more generic (which has the effect of improved maintainability) by moving all test specific information into this configuration file (e.g. [info] section that holds information related to the specific test scenario. We can also define any log files we create at the test script level here, without the need to modify test script code.
By using a database, such as MySql, you save yourself a lot of time in the maintenance and mining of the test data. You also get to, based on the query, select only certain type of data to be included during the current test run.
Click here for an example.
These are table style tests that can be easily consumed by the test script. It should be of the format: keyword1,arg1,arg2,arg3... keyword2,arg1,arg2,arg3... Each 'keyword' is mapped to a method and each 'arg' is mapped to an input parameter for the method. For example if we use the above (in Perl):
eval keyword1($arg1,$arg2,$arg3)
sub keyword1 {
($arg1,$arg2,$arg3) = @_
}
The idea is convert each keyword,arg set into your programming language method,parameters and then call the method with the associated parameters again using your programming language's facility for calling methods. In the example here I use Perl's eval for the purpose.
Click here for an example.