In Part 1 , we learnt about how to do Data Driven Testing using Excel in Brief .
https://www.numpyninja.com/post/data-driven-testing-soapui-pro-ready-api-part-1-using-excel , So in this blog , we will learn how to do data driven testing using Text File, Grid,,, .
What types of testing are supported by SoapUI?
SoapUI can be used for complete RESTful API and SOAP Web Service testing. You can do Functional Testing, Performance Testing, Interoperability Testing, Regression Testing and much more.
Common Steps to do for Data Driven
1. Create Project
Give URL
2. Create New Test Suite
Test Case
Request
3. Add Data Source
Add Data source [ Excel , Text file, Grid, Data Generator , JDBC]
Add Properties
4. Add Data Source Loop
5. Set Request
Get Properties [ select Property from Data Source]
6. Set Response
Get Properties [ select Property from Data Source]
7. Run the Test Case
we can do Data driven using following Sources
Data Driven Testing Using Text File
Data Driven Testing Using Grid
Data Driven Testing Using Data Generator
Data Driven Testing Using JDBC(MySQL Database)
Data Source
For Text file [ , for separator ]
For Grid [Internal Component available in Ready API]
For Data Generator [Inbuilt feature in Ready API]
For JDBC [ Connect to database using driver]
WSDL URL
https://ws.footballpool.dataaccess.eu/info.wso?wsdl
select WSDL Definition ( SOAP)
Data Driven using Text File
Argentina,AR
Australia,AU
Belgium,BE
Brazil,BR
Colombia,CO
Structure of the Project
Add Data Source
Data Source -Drop Down select File
Add Properties
Give text document file path
Mention < , > as separator
Run To download the Data from Text File
Set Request
Get Properties [ select Property from Data Source]
Test Suite -> Test Case-> Test Step -> Properties
${Data Source#countryname}
Set Response
ISO Code->validate -> Select Content->Test Suite ->Test Case->Test Step->Properties
Add Data Source Loop
Take data from source for the Countries Request
Run The Test Case
Successfully Ran Data driven using Text File
Data Driven Using Grid
Grid is internal component available in Grid
Add Data manually in Configuration
Data Source -Drop Down select Grid
Set Request
Get Properties [ select Property from Data Source]
Test Suite -> Test Case-> Test Step -> Properties
${Grid Data Source#countryname}
Set Response
ISO Code->validate -> Select Content->Test Suite ->Test Case->Test Step->Properties
Add Data Source Loop
Run the Test Case
Data Driven Using Data Generator
Data Generator is in-built feature in Ready API, by which we can generate our own data
Test Data will be maintained within Ready API
Data Source -Drop Down select Data Generator
Select Type Country only from dropdown
It has default property name
Set Request
Get Properties [ select Property from Data Source]
Test Suite -> Test Case-> Test Step -> Properties
${DataGenData Source#countryname}
Set Response
Response also Country Name , No ISO Code , as in dropdown Data Generator , you can add only the property given be SoapUI
Add Data Source Loop
Run The Test Case -Data Driven Using Data Generator
Data Driven Using JDBC
Java Data base connectivity to pass data to the request
Ready API connect to database using Driver
Download sql connector
File -> Preferences -> JDBC Preferences
Select MySQL/com.mysql.jdbc.Driver
Settings
Driver
Connection String
Password
SQL Query
Configure Database
Sql Query
Write SQL query
MySql DataBase
Set Request
Get Properties [ select Property from Data Source]
Test Suite -> Test Case-> Test Step -> Properties
${JDBC Data Source#CountryName}
Set Response
ISO Code->validate -> Select Content->Test Suite ->Test Case->Test Step->Properties
Data Source Loop
Run the Test Case
Data Sink Step
URL : http://www.dneonline.com/calculator.asmx
Data Driven and save result in file
Here we can create our test case and write /save result into some external file like text , Excel ...
Test Suite
Test Case
Add Request Step
Request and Response for Add
To Add multiple sets of data , we have to do Data driven
Test Suite
Test Case
Data Sink Data source
Add
Property Transfer 1
Data Sink
Data Sink Data Source Loop
Excel File with column A and column B which has inputs for Addition Calculation
Results will be saved in Addition Column
Add Data Data Source Excel
Excel Path, Sheet1, A2
Add property A and B
Run to download column A data and column B data
Add Data Source Loop
Set Request
Get Properties [ select Property from Data Source]
Form->Test Suite -> Test Case-> Test Step (Data Source) -> Properties (A)
Form->Test Suite -> Test Case-> Test Step (Data Source) -> Properties (B)
${DataSink Data Source#A}
${DataSink Data Source#B}
To write the result in the same excel sheet in third column
Data sink Step
Property transfer
Add Data Sink
Property : Addresult
Data Sink : Excel
Cell : C2(column c, row 2)
We have to run and get the response , from response get the Addresult and write the result in excel file
Set Response
Outline->AddResult -> Property Transfer Step
Property Transfer=Output of one request is transferred as input for another request , so transfer the result output to DataSink
Give Property Name
Give Name for Target Property
Now enter details to Transfer the property
Target Step : Data Sink
Target Property : Addresult
Transfer Name : Addresult
Property Transfer
You can delete Properties Transfer 1 (0)
Run the Test Case
After you run the Test Case , open the excel sheet and Now you can see the Excel sheet is been updated with the Addition Result
Conclusion:
I hope, This article will help you to understand How to do all types of Data Driven Testing in Soap UI Pro. We can do assertion on Test Cases to validate the output .
You must have got an idea on the topics explained in this blog. Lets explore more and learn New Topics.
Happy Learning