BlazeMeter helps move from API functional to API load testing
March 13, 2024

Moving from API Functional Testing to API Load Testing with BlazeMeter

API Testing
Performance Testing

In today's digital landscape, ensuring the performance and reliability of API is crucial for delivering a seamless user experience.API load testing has become a pivotal aspect of this process, with a focus on evaluating how well an API can handle expected and unexpected loads.

This includes not just the average load, but also peak load tests and stress testing scenarios that simulate real-world usage conditions. API load testing performance metrics are essential for understanding the API's capacity and ensuring that it can handle the demands of actual users.

In the very first stages of development, testing usually focuses on functionality rather than any other aspects. But,as the API development moves forward, performance and reliability become priorities so we can find ourselves facing a mature functional testing suite as opposed to a non-performance testing suite.

In this blog, we will discuss transitioning from an existing functional testing suite in SoapUI to a performance testing suite using the BlazeMeter Shift Left Converter. We will also focus on monitoring the availability of our API by configuring system checks using the BlazeMeter API Monitoring tool and the functional testing suite.

Back to top

What is API Functional Testing?

Functional API testing focuses on validating that the API functionality works as expected. This includes returning expected responses according to the business logic and proper error handling. Test cases in functional testing are designed to cover all the possible inputs and outputs that an API can handle, enabling each function of the API to perform as intended.

Back to top

What is API Load Testing?

API load testing aims to find the API processing capacity and its behavior under load. This is highly valuable for planning, resource allocation, and, of course, making sure our API is capable of handling the expected workload while meeting the expected service level in terms of response times, error percentage, and stability.

Back to top

Transitioning to API Load Testing

Understanding the shift from functional testing to API load testing is critical. While functional testing ensures that the API behaves as expected under nominal conditions, load testing evaluates how the API handles increased load, simulating real-world scenarios to ensure reliability under stress.

This transition is essential for maintaining a high-quality user experience, especially as user expectations and system complexity increase.

Back to top

Evaluating Robustness with API Load Testing

API load testing evaluates the API's performance by measuring its robustness, stability, and speed under various conditions. This is crucial for identifying performance bottlenecks and ensuring that the API can handle real-world usage without issues.

To effectively measure an API's performance, a test script is developed, which will simulate a range of requests and user interactions to push the API to its limits and beyond. This script is a critical component of the performance testing process, as it replicates the kind of traffic the API is expected to handle once it goes live.

API load testing involves various types of tests such as load testing, stress testing, spike testing, and soak testing to assess how the API behaves under different scenarios and load patterns.

As a general rule, functional testing takes priority over performance testing. Consequently, it often occurs that performance tests are either omitted or carried out superficially due to project time or resource constraints. Considering this, re-using functional tests for performance testing can be very helpful to reduce the effort of doing performance testing.

Furthermore, following the release of the API to production, it's key to monitor its availability and response performance meticulously to enable prompt action in case of any incidents.

Back to top

Utilizing an Existing Functional Testing Suite to Develop the Performance Test

To begin, we'll utilize a basic SoapUI REST project that interacts with the Pet Store API for logging in https://petstore.swagger.io/.

SoapUI Rest project that interacts with Pet Store API.

To create our performance script from the SoapUI script, we will leverage the BlazeMeter Shift Left Script Converter (https://shiftleft.blazemeter.com/) by following these instructions:

1. Open the BlazeMeter Shift Left Script Converter (https://shiftleft.blazemeter.com/.)

BlazeMeter Shift Left script converter.

2. Drag and drop the SoapUI project, packaged as a .zip file, into the gray area to upload it and begin the script conversion.

The ZIP file is being uploaded.

3. Once the conversion is completed, we will have the option to download the converter script. Click on the "Download from BlazeMeter" button. This will redirect us to our BlazeMeter account, where we can check the new script.

Your script has been successfully converted from SoapUI to Taurus.

4. Please review the generated script. In this instance, we have observed that two scenarios were created, but we only require one. Additionally, we will need to update any password values, as they are not transferred during the conversion process for security reasons.

SoapUI script has been converted to Taurus.

5. After refining the script, we now have the following.

Manually modified Taurus script.

6. Now, we need to specify the load to be applied during the execution. For this example, we will set it to 5 users over 20 seconds.

Setting load to apply in Taurus script.

7. At this stage, we have everything necessary to initiate a stress test by simply clicking the "Run Test" button.

Clock on the "Run Test" button to execute the Taurus script.Back to top

Re-using Existing Test Suite for API Monitoring

Now,we will shift our focus to API monitoring. This will enable us to automate checks on our API, ensuring that we are notified promptly in the event of any performance degradation or downtime when the API is in production.

Similar to the previous section, we will leverage the existing SoapUI project for this purpose.

1. As a first step, we need to export the SoapUI project to the Swagger format. this will enable us to import it into the API Monitoring tool. To do this, in SoapUI, right-click on the project and select "Export Swagger/OpenAPI Definition."

Exporting the SoapUI project to Swagger format.

2. Access your BlazeMeter account and go to the "API Monitoring" module.

Accessing the API Monitoring module.

3. Click on the "Import Test" button.

Click on the "Import Test" button.

4. Choose the "Swagger 2.0 (JSON, YAML)" option. Then select the file generated in step 1, and click the "Import Requests" button.

Choose the script format for import.

5. After the import process is successfully completed, click on the link to access the generated test.

Swagger script has been imported.

6. Now that the test has been created, we need to verify that everything was correctly transferred. Click on the first step to review this specific request.

Confirming that the request has been accurately imported.

7. Update the variable values based on the appropriate ones found in the SoapUI project.

Updating variables with specific values to be used during the checks.

8. Ensure that the assertions were properly imported. They are important for effective API monitoring, as they enable the tool to detect whether the API response is valid. In this instance, since the assertions were not imported, we have added them manually.

Comfirming assertions for the API Monitoring check.

9. Additionally, we need to establish a location from which the tests will be run. Click on the "Edit" link in the Environment section.

Configuring environment for the API Monitoring check.

10. Select "Location" and enable at least one of them.

Setting up a location from which the API check will be executed.

11. Select the "All Tests" link to return to the API Monitoring Dashboard.

Click on the "All Tests" link to return to the API Monitoring dashboard.

12. Now, in the API Monitoring Dashboard, you can click the "Run" button to launch the created test.

Click on the "Run" button to execute API check.

13. You can confirm that the check has been successfully executed.

Confirming the success of the check, service level, and average response time.

Now, we can initiate this test at any time with a simple click of the 'Run' button. However, what's even more significant is the possibility of scheduling this test to run automatically at specified intervals, even up to every minute. This ensures that the tool continually monitors our API availability and response time over time.

This is crucial for our business as it allows us to accurately assess the service level we are providing and promptly take action if necessary.

Back to top

Bottom Line

Moving from API functional to API load testing within a limited time frame can be a substantial undertaking. The more seamless we can make this transition, the better.

We've explored how the BlazeMeter Shift Left Converter and API Monitoring tools assist us in expediting this shift by leveraging the existing functional testing work. And, while there may be some areas that require attention, it's undeniable that this approach was easier than starting from scratch.

As a potential next step, we could consider establishing buckets and alerts to promptly notify the appropriate teams when any anomalies are detected, enabling swift action when necessary.

Ready to elevate your API testing and monitoring game? Start API load testing with BlazeMeter for FREE today!

Start Testing Now

Back to top