HomeOATS

Openscript test data parmeterization with databanks

Openscript test data parmeterization with databanks
Like Tweet Pin it Share Share Email

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:

salesforce-sign-up-page

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
  • Email
  • Company
  • Username

Let us first see how the script looks when creating  a script to register in the above website:

Script Before Parameterization

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

Add_CSV_Databank_Openscript_Parametrization

  • 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.

register-test-data

  • 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:

testdata-parametrize-databank-openscript

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

firstname_select_for_parameterization_double_click

  • 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.

settext_parameterizatin

  • Now click on parametrize-cion  icon to parametrize the data
  • You will be presented with a window “Substitute Variable”

substitute_variable

  • 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.

select_firstname

  • You can now see that an expression is inserted in the place where data was present earlier.

firstname_parameterized

  • 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:

script_parameterized_databank_csv

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 (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.

 

Comments (2)

  • That is an amazing work!
    Thank you so much for your time
    I have a question that how we can restrict iteration on the specific group? Because on each iteration, it is being started from the 1st group of the tree.

    Reply
    • Author

      Hi Faisal,

      Thank you so much for reaching out to us on iterations in Oracle Applications Testing Suite, could you please elaborate your query, as what do you mean by specific group???

      If you were referring to step group, there is no direct way of doing it, but you could write your own logic to understand which iteration the script is currently executing and then you can write some conditional logic to only execute those groups which you want to get executed, hope this clarifies your query.

      Please do let me know if you have any further queries, I would be more than happy to help you.

      Thanks,
      Srinivas P.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *