Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
This blog will learn about the script page and test in Ready API. We will further understand how these tests are performed in Ready API. We will learn about the setup and teardown scripts for performance tests in Ready API. We will discuss the scripting languages, the scripting object, and how to navigate through this object. We will also learn to edit the script.
Ready API is a REST and SOAP API automation tool. It is an integrated suite of applications for API testing. In functional testing, virtualization, and integration, you will be using Ready API. It is an easy-to-use tool for the development team. It makes the process easy and reliable.
Setup and Teardown Scripts👩💻
In this, we will study the setup and teardown scripts for performance tests in Ready API.
⚡The load test execution can be customized. You can also improve it according to your needs and the specifications of your environment.
⚡You will use the custom scripts on the scripts page for improvement and customization. Before the load tests, Ready API runs the setup page, and Teardown scripts are run after it ends.
⚡There are many different easy in which you can use the scripts. When a test case fails, the scripts are used by creating an email with data.
⚡ Load scripts also prepare the database before it starts. When the test run is finished, the log files can also remove the log files.
⚡Whenever you run the distributed tests, the test is run on the agent computers but not on the main computer.
Scripting Languages🧾
We will look at the scripting languages that are used in the setup and teardown scripts for performance tests in Ready API.
The scripting languages Ready API supports are:
🔥Groovy
🔥Rhino Javascript.
The default language of the Ready API in which the project runs is groovy. Using the properties panel, you can change the language of the project.
To reflect the change, you must restart your project.
Scripting Object🔶
We will look at the scripting object that is used in the setup and teardown scripts for performance tests in Ready API.
The following objects and their children are the available scripting objects to which the load scripts can access.
Object
Explanation
loadTestRunner
ReadyAPI tests methods and context properties have access by this object.
log
The logger object writes the data to the script log. By default, the script log is disabled, but you have the feature to enable it on the Global Preferences UI settings tab.
virtRunner
The virtual services mentioned in the Ready API or deployed at VirtServer can be run and stopped by this object.
This object allows you to control the virtual services from the load tests.
Context
Through this object, you can easily access the underlying load test model.
This object provides you with the methods that help to control the load tests' execution.
Navigate the Script👨🏫
To keep the large script, you need to open the panorama view of the editor. This editor is used when you have large scripts too large for the script editor to fit in. To open the panorama, click on. This view helps in the quick hover of the code to move into it.
Edit the Script🎯
With the edit button, you have the feature to edit your script. It has the following edit menu options.
Below is the table with the edit menu and its explanation.
Menu Item
Brief
Delete
The selection gets deleted.
Select All
In the editor, it selects all the text.
Redo
It helps in doing the action again.
Cuts
The selection gets cut.
Folding
In the editor, you can open or close the folds.
Code Completion
The prompt for code completion is opened.
Find/Replace
The prompt of find/replace is open.
Go to line
Moves to the specific line mentioned.
Show Line Numbers
Scroll to find whether the line numbers are visible.
Undo
It helps to go back to the previous action.
Copy
The selection gets copied.
Paste
Paste the clipboard content to the caret position.
User Think Time💭
✨While performing actions, real users have delays. These delays in Ready API are called Think time.
✨These delays can be changed by clicking on the scenario in the load panel.
In the load target section of the editor, enter a new value you want to give to think time.
✨The test that is running the test cases has some delays. The think time field help in specifying the delay between the test steps in the test case.
✨For every virtual user, Ready API will simulate these delays between each test step.
✨For example, if your test has three steps, your think time will be simulated twice.
✨When the load test runs, you cannot edit the time delays.
✨This field only accepts the positive integer.
Test Name and Description🤓
In the properties panel, you can change your test name and description. For doing this, follow the mentioned steps:
🔶In the workspace navigator panel, select your test.
🔶Below the navigator panel, switch to the properties panel.
🔶Double-click on either name or description and change the data in the value column.
When your name includes some special characters, it may cause issues with reporting.
🔶To confirm the change in the page, select enter.
Frequently Asked Questions
What is Ready API?
Ready API is a REST and SOAP API automation tool. It is an integrated suite of applications for API testing.
What is an API, and why is it used?
API stands for an application programming interface. It is used so that there can be an interaction between the two applications.
What are the four types of API?
Web-based applications commonly use these four types of API. These are named public, partner, composite and private.
What is a teardown script?
This script only interacts with the engine and other scripts through API and registry. The registry is the database that helps in saving the data. It runs in its luna context.
In which language are teardown scripts written?
The teardown scripts are written in CPP or C++ language.
Conclusion
In a nutshell, we have discussed the setup and teardown scripts for performance tests in Ready API. We started with the introduction of the Scripts and Ready API. You can refer to the following blogs: