How can you dynamically change your test data at run-time using IBM Rational Integration Tester (RIT) of IBM Rational Test Workbench?
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.
Refer to the test data sections in the RIT Reference Guide 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 demonstrate this. The example iterates through a file to extract three file names. The sample then uses the files as three sets of test data. The sample extract 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 filename 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 filename.
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.
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Dynamic Test Data.zip
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.