Using Data Sources

Applies to ReadyAPI 3.57, last modified on December 20, 2024

In ReadyAPI, you can use different input data to control the test scenario, ensuring the web service works properly in different cases. For that purpose, you can use data sources, which can gather and store information you need to perform any tests you need.

Data Source Types

In ReadyAPI, you can use data sources of different types. Some of them allow using external storages like databases or Excel sheets, and other can generate random data right during the test run.

To learn about available data source types, see Data Source Types.

Availability

You can use data sources in functional tests to populate testing properties and switch between different data:

In virtual services, you can use the data source’s data to form the service’s response. To learn how to do that, see Data Sources in Virtual Services.

Note: Data sources are a Pro feature. To use them in functional tests and virtual services, you need ReadyAPI Test and ReadyAPI Virtualization licenses respectively.

Generate Data Source Automatically

ReadyAPI can automatically generate values for parameters in request test steps. The value type is deduced from the type of the parameter that is specified in the service definition or, if it's not possible, from the parameter name.

If you choose to generate values automatically, ReadyAPI will create a Data Generator data source and will fill it with properties based on the request parameters. The request parameters will automatically refer to the data source properties using property expansions. The request test steps, for which properties were generated, will be within a data source loop.

How automatic value generation works

Click the image to enlarge it.

When you run a test case, the data source will generate random values of the specified type and insert them into the request as parameters.

How to generate values automatically

There are two ways to generate values automatically:

  • On the test case level - In this case, ReadyAPI will be able to generate values for several requests in one test case.

    1. Add the Data Source test step in the test case editor and select Yes in the Generate properties dialog:

      ReadyAPI: Create a DataSource test step

      Click the image to enlarge it.

      Note: If you choose to generate values automatically, ReadyAPI will simply create an empty data source test step. You can configure it at any time.
    2. In the Create Data-Driven Loop dialog, check the parameters for which you want to generate properties automatically and click OK:

      ReadyAPI: Data-Driven Loop dialog
  • On the test step level - In this case, ReadyAPI will generate values only for one request test step.

    1. Click Generate Values in the request test step editor.

    2. In the Create Data-Driven Loop dialog, check the parameters for which you want to generate properties automatically and click OK:

      ReadyAPI: Generate values

      Click the image to enlarge it.

Database Data Sources

To use database data sources in ReadyAPI, you need properly configured connection strings.

Some of database drivers have prebuilt connection strings. You can find them in the ReadyAPI preferences, on the JDBC drivers page, or see Preconfigured JDBC Drivers.

You can configure additional connection strings in the Databases manager. To learn how to do that, see Database Manager.

See Also

Basic Concepts of Data-Driven Testing
Database Manager
Data Sources and Data-Driven Tests

Watch the video
 
Highlight search results