Table of contents
1.
Introduction
2.
Ready API
3.
Using the Data Sources
3.1.
Data Source Types
3.2.
Generating Data Sources Automatically
3.3.
Database Data Sources 
4.
Data-Driven Testing
4.1.
Setting up a Data Source Loop
4.2.
Configure Data Source Loop
4.3.
Where should we Insert Data?
4.4.
How does it Work?
5.
Frequently Asked Questions
5.1.
What exactly is a data source in ReadyAPI?
5.2.
What is the need for ReadyAPI?
5.3.
What are some of ReadyAPI's key features?
5.4.
What is the architecture of the ReadyAPI?
5.5.
Is data-driven testing supported by ReadyAPI? What data sources can be used?
6.
Conclusion
Last Updated: Mar 27, 2024

Testing API using Data Sources in Ready API

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Hello Techies!

This article will discuss Testing API using Data Sources in Ready API. We will start off with a brief introduction to ready API and then move forward with using data sources for testing API using data sources in Ready API.

Introduction

The later part of the blog will deal with the essential concepts of data-driven testing that will help us understand Testing API using Data Sources in Ready API. So let’s get started!

Ready API

Ready API is a no-code API testing platform that simplifies your testing procedures. By using Ready API we can automate end-to-end tests and scale across many API types. We can run load tests that are compatible with your functional tests. We can also allow virtualization to ensure that your development teams have fast and dependable integrations.

ReadyAPI Logo

Ready API is a centralized, automated testing platform that allows teams to build, manage, and execute performance tests.

Using the Data Sources

In ReadyAPI, you can utilize various input data to control the test scenario, verifying that the web service functions correctly in multiple scenarios.  You can accomplish this by using data sources to collect and store the information required to execute any testing.

Data Sources

Data Source Types

Data sources of several types can be used in ReadyAPI. Some of them support external storage such as databases or Excel sheets, while others can generate random data while the test is running.

Below is a list of Data Sources that can be used with a description:

Data Source

Description

Data Connection Uses a JDBC connection to retrieve data from a database. It works the same way as the JDBC data source but uses preconfigured JDBC database connections.
Data Generator Uses the built-in data generator engine to generate data.
Excel Data is obtained from the Excel tables.
File Line by line, it retrieves the content of the provided file.
JDBC Uses a JDBC connection to retrieve data from a database. It employs a connection defined in the data source instead of the Data Connection data source.
Grid Obtains information from a grid.
Groovy A Groovy script is used to generate data.
JSON JSONPath expressions are used to extract the desired info from the JSON content.
XML Using XPath expressions, it extracts the desired data from the XML text.
Directory Iterates across the directory and retrieves file content.

ReadyAPI Test and ReadyAPI Virtualization licenses are required to use Data Sources in functional tests and virtual services, respectively, as they are a “Pro Feature.”

Generating Data Sources Automatically

ReadyAPI can produce values for parameters in request test phases automatically. The value type is determined by the kind of parameter indicated in the service specification or, if that is not feasible, by the parameter name.

If you select to automatically generate values, ReadyAPI will establish a Data Generator data source and populate it with properties based on the request parameters. The request parameters will automatically relate to the data source properties using property expansions. A data source loop will contain the request test stages for which properties were generated.

When you execute a test case, the data source generates random values of the given type and inserts them as parameters into the request.

Database Data Sources 

Connection strings must be properly configured to use database data sources in ReadyAPI. Some database drivers include predefined connection strings. They can be found in the ReadyAPI options, on the JDBC drivers page, or by searching for Preconfigured JDBC Drivers. Additional connection strings can be configured in the Databases manager.

Data-Driven Testing

After knowing about using Data sources, it’s time for us to learn Testing API using Data Sources in Ready API. This section will primarily focus on the basic concepts of Data-Driven Testing.

You can build many requests or test cases with variable data. A preferable method, though, is to segregate data from test stages. In other words, rather than using hard-coded values, a data-driven test can receive test data from some storage, such as a CSV file or database, and utilize this data to parameterize requests sent. This distinction simplifies your test logically. Furthermore, such tests are easier to change and manage than tests with many sets of hard-coded values.

It is considered best practice to save input data and check values in a data storage system. This method allows you to simply specify verification data for each segment of test data.

You can use the following data sources in ReadyAPI:

  • External files include comma-separated value files (.csv), Excel sheets, and other formats.
  • Databases include MySQL, Oracle, Microsoft SQL Server, etc.
  • The internal data sources are where you can create a table data source and do manual data entry, or you can use a built-in data generator.

Setting up a Data Source Loop

The essence of data-driven testing is to repeat the same actions with different data. To accomplish this, you must include a data source loop in your test case. There are various methods for creating a data source loop:

1. Create a Data Source test step in the Generate properties dialogue and select Yes. This will generate and configure a data source loop and allow you to put numerous request test steps in it.

2. Click Generate Values after opening a request test step. This will establish and configure a data source loop that just includes this test step.

3. Create a Data Source Loop test step and manually set it up.

Configure Data Source Loop

Let us see how to configure the Data source loop for testing API using Data sources in Ready API.

To set up the data source loop, do the following: 

  • Select the Data Source Loop test step and double-click it.
  • Choose the data source that will be used in the loop.
  • Choose the desired test phase. This is the step from which the loop will begin.
  • Close the dialogue and place all of the steps you wish to repeat after the target test step and before the loop test step. 
  • Make that the data source test step comes before the start of the loop.
    Configure Data Source Loop

Where should we Insert Data?

The answer is simple.  You can insert it in request parameters, headers, and bodies to simulate requests with different data or assertions to verify received responses, virtual service responses, test step properties, and so on.

How does it Work?

This testing methodology is known as "data-driven testing" because it separates the test case data from the test case logic. The same test processes are repeated in the same order in a number of test scripts that you build, but with different sets of test data.

The test conducted should analyze responses that include:

  • Reply time
  • Data quality
  • Confirmation of authorization
  • HTTP status code 
  • Error codes

Frequently Asked Questions

What exactly is a data source in ReadyAPI?

ReadyAPI data sources are a valuable tool for creating data-driven testing. Data sources, by default, only deliver the data they take from the source to any test phase that requires it.

What is the need for ReadyAPI?

Ready API is a tool that helps in web services' functional and load testing.

What are some of ReadyAPI's key features?

ReadyAPI is a tool for developing and running API tests. It has tools for designing test cases, running tests, and providing reports. It also includes a mimicking service tool that can be used to simulate API replies during testing.

What is the architecture of the ReadyAPI?

ReadyAPI is an API testing tool developed on top of SoapUI. SoapUI is used for functional testing, whereas ReadyAPI adds functionality such as load testing, security testing, and virtualization.

Is data-driven testing supported by ReadyAPI? What data sources can be used?

Yes, data-driven testing is supported by ReadyAPI. Excel, CSV, and XML files are among the data sources that can be used.

Conclusion

We hope now you know how to execute testing API using data sources in Ready API. In this blog, we introduced the Ready API, then saw how to use data sources, types of data sources, and how to generate them automatically. We then moved forward with the data-driven testing and tried to understand its various concepts.

If you want to learn more about Ready API, follow the given links:

Please refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. And also, enroll in our courses and refer to the mock test and problems available. Have a look at the interview experiences and interview bundle for placement preparations.

Keep learning, and Keep Growing!

Live masterclass