Table of contents
1.
Introduction
2.
How can we debug tests in ReadyAPI?
2.1.
Sample Example
3.
Adding Breakpoint
3.1.
Sample Example
3.2.
Create a conditional breakpoint 
4.
Frequently Asked Questions  
4.1.
Why automate tests?
4.2.
How can we use SmartBear ReadyAPI?
4.3.
What is the difference between ReadyAPI and Postman?
5.
Conclusion
Last Updated: Mar 27, 2024

Debugging Tests in Ready API

Author Neha Chauhan
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

ReadyAPI is an API testing platform. It allows developers to automate testing. 

It can be used for different types of testing - 

⭐ Functional Testing - You can set tests for each application's functionality and check if your service works as expected. You can also test the security of your service and verify that it can resist the most common attacks. 

⭐ Performance Testing - You can test the performance of the service against various situations. 

Virtualization allows you to test the performance of API in real-world scenarios. It imitates real-world experiences and runs your API against them. 

Debugging tests in ReadyAPI

Your testing scripts might contain some bugs. We can debug the code step-by-step in ReadyAPI. 

In this article, we will discuss how to debug functionality testing scripts with the help of an example. 

How can we debug tests in ReadyAPI?

You can debug the functionality testing code step-by-step. You can also create breakpoints to pause between these steps. 

You can read about the test steps here.

Sample Example

Let’s try to understand everything with the help of an example. 

ReadyAPI has curated some sample test projects for it’s users. These sample test projects help in understanding test scripts. There are many sample test projects available, like - SOAP sample project, REST sample project, Data driven test project, security sample project, SQL injection sample project, etc.

For this example, let’s use a REST sample project.

Let’s get started 🏁

🐻 Open ReadyAPI. 

🐻 Open the Dashboard tab. On the left-hand side, you can see Sample Projects

🐻 Click on REST Sample Project

output


🐻 Go to REST Sample ProjectFunctional TestsSample REST Test Suite

🐻 There are many sample test scripts. For this example, let’s use Simple Login Call. In the Simple Login Call, there are three steps, start serviceLogin and stop service.

If you click on button, the script will run all the steps continuously one after the            other without stopping at any point. This will not help us in debugging the script. But if we could test each step separately, it would help us in finding the bug. 

✅ Use Step-by-Step Run to debug the code at each step. 

output

🐻 Use the Play button ▶️, to run the script step by step. 

output


🐻 Click on the Play Button ▶️, Start Service step will run, after which it will pause execution. Click on it ▶️ again, the REST Login step will be executed and execution will be paused. Click on it ▶️ again, the Stop Service step is executed. Since there was no error, the test script is PASSED. 

On your right-hand side, you will see a list of parameters. Some of them change as we execute each step. (*) is used to represent that the parameter has been changed.

Start Service SOAP

Adding Breakpoint

Suppose your test script has twenty steps. You are confident that there is no error between line 1 to line 15. Using a step-by-step method and checking each step will be a waste of time. Instead, we can create a Breakpoint are line 16. This breakpoint will pause the execution at line 16. 

To create a Breakpoint click on the BP column on the left side of each test step. 

Sample Example

Let’s use the SOAP sample project as our example. 

🐻 Go to SOAP Sample ProjectFunctional TestsSimple Search Test Case

🐻 Select the Step-by-step method. 

You can see that there are eight steps. Let’s create a breakpoint at step five, Property Transfer - Move sessionID. 

🐻 Simply click on the BP column on the left side of the step. 

Property Transfer SOAP

🐻 Click on button. 

✅ Your test script will run all the steps before Property Transfer - Move sessionID and pause. 

After this, you can either run the script step by step or click on to run all the way to the next breakpoint (which in this case is the ending of the test script.)

Create a conditional breakpoint 

If you want to pause at the breakpoint when a certain condition satisfies, you do so by writing a code under Breakpoint Properties. Write a Groovy script that returns true or false.

🐻 Right click on the breakpoint > Breakpoint Properties .

BreakPoint Properties

🐻 Select the Conditional check box. Enter the groovy test code. 

Conditional Check Box SOAP

Let’s Summarize whatever we discussed in this article - 

1️⃣ Use the step-by-step method to debug the test script step by step.

2️⃣ UseRun next stepto run each step. 

3️⃣ Use to run till the next breakpoint. 

4️⃣ The astreck (*) sign indicates that the parameter value has been changed. 

5️⃣ Add a breakpoint by clicking on the BP column on the left hand side of the test step.

6️⃣ Add a conditional breakpoint from Breakpoint Properties

Frequently Asked Questions  

Why automate tests?

If all the testing is done by developers/testers, it wastes human resources. We can optimise these tests and automate them for similar tests. It is more efficient and saves a lot of resources.

How can we use SmartBear ReadyAPI?

To use ReadyAPI, download and install the product. There is a 14 days free trial of the product. After the free trial has ended you can buy the license to use the product for commercial use. There are two types of licenses- File Based and SmartBear ID based. These licenses are valid for 1-3 years.

What is the difference between ReadyAPI and Postman?

Since Postman is designed to work with each individual API endpoint, it is nearly hard to manage and monitor end-to-end testing over time. Since each test case is customised for ReadyAPI, tests may include a variety of endpoints, resources, or data sets. Then, inside a Test Suite and, ultimately, a Test Project, each test case can be added, copied, or deleted. As a result, managing and keeping up with test cases is easy.

Conclusion

Pat yourself on the back for coming this far. In this article, we have discussed how to debug test scripts using ReadyAPI. We used the REST Sample project to understand how to debug the script step by step. To understand how to apply breakpoints, we used SOAP Sample project. 

Do not stop learning! We recommend you read some of our ReadyAPI articles -

🔥 What is ReadyAPI?

🔥 Installing ReadyAPI.

🔥 What are test scripts?

🔥 Security Tests in ReadyAPI

Head to the Guided Path on the Coding Ninjas Studio and upskill in Data Structures and AlgorithmsCompetitive ProgrammingSystem Design, and many more courses.

If you want to Practice top Coding Problems, attempt mock tests, or read interview experiences, head to the Coding Ninjas Studio, our practice platform.

We wish you Good Luck!🎈 Please upvote our blog 🏆 and help other ninjas grow.

Live masterclass