As you all know the main purpose of creating automation test scripts is to run the scripts for multiple sets of data and increase the test coverage with several combinations of test data, while there are several ways to parameterize scripts in Oracle Application testing suite, this article limits to knowing as how to parametrize openscript scripts using Databanks.
Assuming that you know how to record a script using openscript, once you have recorded a specific test case in openscript, first thing you need to identify is what are all the input data that you want to parametrize so that the same script can be executed repeatedly for different sets of test data.
Just to keep the understanding easy & clear, let me explain you with an example here:
You can navigate to signup page of developer.salesforce website you would see a registration page as below:
There are 9 input fields in the above registration page, but as per this test case let us consider that, you want to run this test case for registering only developers from India residing in a specific Postal Code. So when you consider this scenario, there is no use of parametrizing test data for fields like “Role“,”Country“,”Postal Code” and checking the checkbox to accept agreement as they remain constant as per the above consideration.
Now we are left with the following fields, which could be parametrized for executing the scripts for multiple sets of test data.
- First Name
- Last Name
Let us first see how the script looks when creating a script to register in the above website:
Now, in order to parametrize the fields as per above, perform the below steps:
Steps to add a CSV File based databank @ openscript for test data parametrization
- Click on “Assets” tab of the script’
- Select Databanks in the tree
- Click on Add button on the right side of the window
- Select “CSV File” option
- Navigate to desired folder location as where you want to store the databank.
- Give a name for example “register-test-data” and click on OK Button.
- Select the newly created databank in “Assets” tab and click on “Open” Button
- You will be presented with a plain text editor in the openscript IDE.
- Now, enter the field names you want to parametrize with comma separated names i.e. firstname,lastname,email,company,username
- Note: the first row in this file is considered as parametrized names for these fields.
- Now you need to give multiple sets of data that you want to use for registering the website as below:
Now that you have successfully created a databank for this script, lets follow the below steps to parametrize the script with this databank.
Steps to parametrize script using the CSV File based Databank
- Navigate to “TreeView” of the script.
- Double click on “first_name” field in the treeview
- You will be presented with a window by name “Set Text” which contains the first name that you have given during the time the script was recorded.
- In that window you can see a databank with name “register-test-data” that you have created some time back.
- Select “firstname” and click finish.
- You can now see that an expression is inserted in the place where data was present earlier.
- Click OK button.
There it is you are done with parametrization of firstname field, repeat the same steps to parametrize other fields and you would be done with test data parametrization as below:
You are all set now with test data parametrization for the desired fields, in the above example we have given 2 sets of test data in the CSV file based databank, in order to execute this script for all test data sets, you need to click on iterate () button in the openscript IDE and not the normal playback button and click on “OK” button when you are presented with “Iterate” window. The default settings in this window is the execute for all sets of test data provided in databank.
In case of any queries, please feel free to reach out to me through comments, I would be more than happy to assist you in this.