As we continue to modernize legacy systems for DevOps, we run into test scripts using hardcoded data. This reminded me of the Y2K issue all too well. If the data value change in those scripts a team of people will be needed to identify all the scripts containing that field value. One way to avoid constant manual maintenance is to create a parameterization data sheet to be used in Rational Functional Tester (RFT).
My colleague, Tony Clay, and I were provided over 250 record and playback test scripts and an excel spreadsheet with the field name and data. The data wasn’t straight forward, there were special characters and leading zero. A trim function was used for extra spaces and to handle special characters too. The steps below was the solution provided using RFT and the Excel Data sheet.
Step 1 – Create a test case tracker spreadsheet for each module with the columns below.
Step 2 – Manually open each script to identify which Automation Scripts contained hardcoded data. Some scripts were excluded from parameterization because they were transfer screens. Hint: Keep a tracker for the next person.
Step 3 – Add spreadsheet to RFT Data Folder. We created a folder called RunTimeData. This file maintain updated data as the project is imported/exported.
Step 4 – Used the ExcelUtility. Created a method called getData ( ) and provided the values for each field in the spreadsheet.
Step 5 – Create a Global Data Class in the RunTimeData Folder. Import existing or new classes to be used for Global Data (i.e. ExcelUtility). The class will utilize the setdata and getdata to return the row data in the datasheet.
Step 6 – Updated the Automation Test Script to convert hardcoded data into parameterized data using a spreadsheet. We standardized the scripts by adding the new classes and data declaration statement. Used the "data." in access the Global Data setData( ) and getData( ). The correct data retrieved based on the screenName( ). Hint: See my blog to modify the Script template for the project. It will be there when creating a new script.
Step 7 – Final step. Modified the hardcoded values.
Before Parameterization (almost, I didn’t have a screenshot)
After Parameterization (almost, I didn’t have a screenshot)
I’ll continue to find other tips & tricks from my QA Automation Tester days.
Lettie Ar-Rahmaan, MSIS CTFL
Product Manager, Rational Test
IBM DevOps – Test Automation
willetta@us.ibm.com
#RationalFunctionalTester