In the previous article you have learnt how to create a web services testing script using OATS, in this article let us see how to parametrize a web services test automation script assuming that you are aware of why test data parametrization is required for a test automation script.
There are couple of ways of parametrizing a web services test automation script using OATS – Oracle Application Testing Suite, but in this article you will learn how to parametrize script with Openscript IDE of Oracle Application Testing Suite / OATS.
Step by Step Instructions to parametrize web services testing script
In the Openscript IDE
- Click on Assets tab
- Select Databanks and click on Add > CSV File
- Give a Databank name (preferred path is the place where the script resides) in the Databank Folder Window and click Ok Button
- Select the newly added databank and click on open
- A window opens, here you can give first row as the header columns for your databank, i.e. to understand what test data to be given, first row will contain all the header columns, for example in this script, we can give as “CountryName” as header column, you can also add multiple headers based on need to be able to input multiple test data, these headers are separated with a comma delimiter as this is a csv file.
- All the rows below this header row will become the actual test data, you can give multiple test data rows in each row, for this example give United States and India in 2 different rows as below
- Click on Save
- Go back to Tree view of the script
- Double click on the post data node
- Expand till we get the input parameter for your method, which you want to invoke as part of the web service execution.
- Select the row and click on the Substitute variable icon .
- Now you can see the databank and the headers provided in the csv file will be listed to select as which header column to be considered as input for this field in the script.
- Select “CountryName” and click on Finish button of the Substitute Variable Dialog Window, Click on OK button of “Post Data” Dialog window to complete the parametrization option
- Click on Save of Openscript IDE
- Now you have successfully parametrized this small webservices script and be able to run for 2 different sets of data which is “United States” and “India”
- Now you have to run the script for all test data records given in the databank, you can see 2 icons in the tool bar playback icon and iterate icon .
- For the script to run for multiple iterations, you need to click on iterate icon and provide data as below screenshot and click on OK button to trigger the execution.
- The script now runs for two rows of test data and gives the result steps for 2 iterations, click on the results and select the current result and check the Details View, you can see that it shows 2 Iterations, expanding those further you can see different test data is been used for the 2 iterations and has separate results steps for the same.
Please do leave your queries as form of comments, I would be more than happy to help.
Very informative…liked this approach
Thank you animesh, nice to see that you like it. Keep watching the space for more posts and tutorials.
Very useful information Srini, Thank you ! I executed , it is working fine
Great 🙂 I am happy that you could successful parametrize test data for Web Services script in Oracle Application Testing Suite ( a.k.a OATS )
Can i read data in databank as a string
Yes of course you can 🙂 if you go in to code view after performing the steps in this article, you should be able to see the script for the same.