Question & Answer
Question
How can you dynamically change your test data at run-time using IBM Rational Integration Tester (RIT) of IBM Rational Test Workbench (RTW)?
Cause
You want to change the source or location of your test data at run-time. You use a value from your test to retrieve test data in subsequent test steps.
You derive the test data from files or database tables.
Test data sets are evaluated during the initialization phase of a test. If you simply use a test tag in your test data set definition, the test will not run. The reason is that the tag value will not be valid at the start of the test.
Answer
Refer to the test data sections in the Rational Integration Tester Knowledge Center when following this solution.
The way to solve this is to have a parent test that calls a child test. The parent test gets the value for the test data location and passes that value to the child test.
The attachment contains a sample project to demonstrate this. The example iterates through a file to extract three further file names. The sample then uses these file names as three sets of test data. The sample extracts values from each of the three files and displays the values in the test console.
The high-level steps are as follows.
- Create a File Data Source that references the text file containing the file names.
Click Refresh to verify the configuration.
- Create a File Data Source that references the individual files using a tag. Use a tag name of your choice.
Click Refresh to verify and enter a file name value for the tag when prompted.
- Create the Child test and add a test tag with the same name as that used in step 2.
This will be used for the Test Data Set and must have a default value that is valid file name.
This ensures that when the test is initialized, the Test Data Set can be parsed.
- Add an Iterate Test Data step to read the file contents.
- Create the Parent test and add an Iterate Test Data step to read through the list of file names.
- Add a Run Test step to run the Child test.
Pass the file name tag to the Child test.
The file name tag will be used in the Test Data Set to read the specified file.
The same principle can be used with the Database Data Source. If the query uses a tag value you follow the above procedure. The parent test sets the tag value and passes it into a child test which runs the query and accesses the test data.
Was this topic helpful?
Document Information
Modified date:
29 September 2018
UID
swg21611029