Applies to ReadyAPI 3.0, last modified on November 12, 2019

About Data-Driven Testing

Automated tests send requests to the tested web service and cover a certain area of this service. Rather often, they use only one set of parameters, that is, check one set of data. It is quite possible that this data does not cause errors in web service functioning, but other data may cause them. To get better coverage, you can run tests with different data. This will help you ensure that your API works as expected for various input values. This is what data-driven testing is about.

You can create several requests or test cases with different data. However, a better approach is to separate data from test steps. That is, instead of using hard-coded values, a data-driven test can read test data from some storage, like a CSV file or database, and use this data to parameterize requests it sends. This separation makes your test logically simpler. Also, it is easier to edit and maintain such tests in comparison with a test that contains several sets of hard-coded values.

It is considered to be a good practice to store both input data and verifying values in a data storage. This approach lets you easily specify verification data for each portion of test data.

Supported Data Storages

In ReadyAPI, you can use various data sources:

  • External files: comma-separated value files (.csv), Excel sheets, and so on.
  • Databases: MySQL, Oracle, Microsoft SQL Server, and others.
  • Internal data sources (you can create a table data source and fill it with data manually, or you can use a built-in data generator).

For complete information, see Data Source Types.

How to Refer Data in Tests

  1. You add the DataSource test step to your test case and connect it to a data source of the supported type (see above).

  2. You then select the data source columns to be available in tests. In ReadyAPI terms, these columns are called properties.

  3. To refer to a property, you use special expressions called property expansions, for example:

    Web service testing with ReadyAPI: Property expasions

    The test engine will “expand” this expression during the test run. For complete information on them and supported syntax, see Property Expansion.

    You can type these expressions, or use the Get Data command to invoke a dialog, where you can choose the needed property visually (see below). You can find this command in the context menu. Some edit boxes and grid cells also offer the ellipsis button:

    Web service testing with ReadyAPI: The Get Data command
    Web service testing with ReadyAPI: Calling the Get Data dialog (ellipsis button)

    Here is a sample view of the dialog:

    Web service testing with ReadyAPI: The Get Data dialog

    Click the image to enlarge it.

    Property expansions are universal. You can use them not only to retrieve database data, but also to extract values from XML and JSON responses and pass them to other test steps.

For detailed step-by-step explanation, see Tutorials below.

Where Can I Insert Data?

Almost anywhere:

  • Request parameters, headers, and bodies (to simulate requests with different data)
  • Assertions (to verify received responses)
  • Virtual service responses
  • Test step properties
  • And so on


Follow these links to learn how you can use various data sources for data-driven testing of your APIs:

See Also

Transferring Property Values
Property Expansion
Data Sources and Data-Driven Tests

Highlight search results