A data-based testcase means a testcase that runs a test repeatedly with varying predefined data in a table. The idea is to assess your service under test with different data and verify the results later in a table.
This kind of data-based tests can be achieved with the Testcase type Databased Testcase.
See the step-by-step tutorial Create a DatabasedTestcase for more information how to perform this task.
A DatabasedTestcase is a specific Testcase type that you create in the View Testcase List. It uses the following elements:
This teststep is meant to provide the date for the Data Loop. Depending on our edition (Community Edition or Standard Edition) you have two options to provide your tabular data
All of these options foresee a mapping between columns of your table and a variable in your Test hierarchy, as you can see in the following screenshot
A query-based valuelist input allows you to use a query language like XQuery, XPath or JSONPath to provide variables values from an HTTP/SOAP Teststep response and loop over each element in your Databased Testcase.
A query-based valuelist input provides a powerful option to read a list of elements from an HTTP/SOAP Teststep reponse and delivers the top level child elments as columns in table. This is the input for our Databased Testcase Run Loop.
the following image shows a sample JSON- response with a number of invoice elements that hold sub elements. We want to iterate over these invoice elements and use the sub elements as columns in an input table, as you would do use a CSV file or a manual table.
We will illustrate this with the following use case, as some transformations would apply when querying JSON-Elements or XML-Elements and provide them as flat table with columns and rows. Let's test a REST-service that exposes two routes:
We want to verify that each invoice returned from the first route can be received in the second route and want to make sure that the information on the invoice-element corresponds to the metadata returned in the JSON-element.
Each Element is a JSON-Dictionary that holds three key/value-pairs, the webservice call would return 10 invoice elements:
We will apply the following JSONPath to extract the information for each Dictionary in the list and create an Input table for our Databased-Testcase:
JSONPath: $.invoiceElements.*
Here we go. We have the input for the Databased Testcase Run Loop. Each column entry is automatically assigned to a Variable that has been created for you. You may use this in call of the second webservice in such a way:
A Databased Testcase run performs the following logic:
This Teststep gives you the option to write any Variable values in the Test definition hierarchy to a result table. This result table is stored internally and can be exported to a CSV-file. You can append new results to the end of the table with new test runs or simply override any existing entry with the option Append to end of file.