Pages

07 July 2011

SoapUI Excel DataSource Definition & DataSourceLoop Usage

Comprehensive test suites require varying test datasets to cover many cases each of which can be the reason of a bug, in advance. In order to eliminate the possibility of unexpected behaviours of target application, using prepared large portion of test datasets in test cases are essential in software testing. However, preparing a test case for each of different test data might be troublesome to developer. Thus, parametrizing the inputs and using datasets iteratively to fulfill the inputs is the answer to problem.

In soapUI, datasources can be added to test cases to retrieve test datasets from databases(Oracle, MySQL, Derby, SqlServer, etc.), excel files(*.xls) or files(*.xml, *.txt). Below, in SoapUI test suites, I shortly intended to present:
  • how to use excel files as a datasource 
  • how to iterate on datasets of datasource with DataSourceLoops
  • how to parametrize your test datas to your test cases' inputs
In your soapUI project, add a datasource to your test steps then define a good name for it.  Follow the steps:
  1. Select your test data excel (only xls files, not xlsx)
  2. Define your worksheet name
  3. Set the name of first cell that value has initial data in it. Values of cells, under the first cell, will be retrieved
SoapUI Excel DataSource Settings
SoapUI Excel DataSource Settings

DataSources are pathetic without a DataSourceLoops which iterates test data that is retrieved by DataSource Step and forward the test execution to the Target Step. Thus, a loop will continue till the end of datasets of datasource.

Configure Datasource Loop

Below, I put a short description next to each test step and highlighted the steps that will be executed in the DataSourceLoop till the end of the last record in the excel file.

1. VARIABLES: define variables
2. Excel: retrieve data set from excel datasource
3. Property Transfer: transfer current data from data set to variable
4. Service Invoke: service invoke with variable
5. DataSource Loop: Iterate data set, go to step 3

SoapUI Project Explorer
Final view of soapUI project (Ignore the disabled step MySQL in this screenshot)

1 comment:

Thx for reading! Comments are appreciated...