Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
ReadyAPI provides development and testing teams with a powerful tool for creating, running, and analyzing complex tests on REST, SOAP, and Apache Kafka APIs, JMS, JDBC, and other web services.
This article will teach us about Updating and Refactoring APIs in Ready API. So, keep reading :).
You will learn about:
Updating APIs
Refactoring REST APIs
Refactoring SOAP APIs
Updating SOAP Request Test Steps
Updating Kafka schemas
Updating APIs
New requests are added to the service you are testing, and old requests are updated with new parameters as it develops. ReadyAPI's definition is not updated automatically. Therefore it becomes out of date. You can keep your service updated by using the updating and refactoring definition dialog boxes. Each dialog box has a unique set of applications:
⭐⭐You may update the definition when
New requests are added.
New parameters are added to existing requests.
⭐⭐You may refactor the definition when
Names of parameters are modified.
Requests are renamed.
Resource or Operation name is changed.
Updating the Definition
➡️Go to Projects.
➡️In the Navigator panel, right-click the REST service or SOAP interface you want to update and choose Update Definition.
📝Note: One way is to choose the necessary item and use the F5 hotkey.
➡️If the old SOAP definition's specified bindings are missing from the new definition, you will need to remap them or use SOAP Refactoring to update the definition. REST definitions are automatically updated based on the Update Definition dialog box selections.
REST Update Definition Dialog
Option
Description
Definition URL
The path to the required definition. To locate the file in the file explorer, click Browse.
Delete custom resources
It removes all resources that are not mentioned in the new definition.
Delete custom methods
It removes all methods that are not defined in the new definition and are linked with resources that are specified in the definition.
Delete custom parameters
It removes all parameters related to requests given in the definition that are not specified in the new definition.
Add new methods to virtual services
This option adds new methods to ReadyAPI virtual APIs in the same project.
Delete custom methods from virtual services
It removes methods that are not present from the imported definition from virtual APIs.
Definition format
It defines the format of the imported definition. Available Options are: WADL and Swagger.
SOAP Update Definition Dialog
Option
Description
Definition URL
Add the path to the definition. Click Browse to find the file in the file explorer.
Create New Requests
It creates default requests for the new operations in the service.
Recreate Requests
It recreates old requests according to the new schema. This affects SOAP Request test steps in the functional tests.
Recreate Optional
This creates optional elements when recreating requests.
Keep Existing
Recommended. Its value is preserved if the element name and namespace are the same in old and new definitions.
Keep SOAP Headers
Do not change the SOAP headers when recreating the request.
Create Backups
Recommended. It creates backup requests and SOAP Request test steps when recreating the requests.
Update Requests
It updates all requests in the interface.
Open Request List
It opens the panel with a list of updated requests.
Refactoring REST APIs
If your web service has been updated, you may have to change the test cases and requests in ReadyAPI. The Refactor Definition command from ReadyAPI makes this easier. The function opens a dialog box. You can use it to create a link between old and new resources, methods, and requests and their parameters. ReadyAPI will automatically change your project's requests and test steps to respond to the updated definition.
📝Note: You cannot do REST refactoring if your API does not have a WADL or Swagger/OpenAPI description.
You need the ReadyAPI Test License to use refactoring.
Start the refactoring.
Switch to Projects.
Do any of the following:
Refactor Definition can be found in the context menu when you right-click your web service in the Navigator panel.
OR
In the Navigator panel, choose your web service, then click Refactor on the toolbar:
OR
Choose API > Refactor Definition from the main menu after selecting your web service in the Navigator panel:
The Refactor Definition dialog will appear.
Load the updated definition
1️⃣Select the update definition that will be used during refactoring in the Refactor Definition dialog box.
2️⃣Add the definition URL in the Definition URL edit box.
3️⃣Use Definition Format settings to mention the format of the definition you are loading.
4️⃣Select “Create New Requests” to create new requests.
5️⃣If the definition file specifies multiple services, select the one you need:
6️⃣ReadyAPI will now load and analyze the new definition.
7️⃣The following dialog box sets the correspondence between old and new operations.
Refactor definition
Specify which existing resources, methods, and requests match new ones in the Refactoring REST Definitions dialog box:
Resources, methods, or requests that have been used before are shown on the left of the dialog box, while new items are shown on the right. ReadyAPI automatically matches the entries in the new and old lists. Old items that don't match the new ones show up in red, while new items that don't match the old ones show up in blue.
The following is how to match new requests with current resources, methods, and resources:
You connect an already existing resource, method, or request to match a new one. To do that, select an item from one panel, select the matching item in the other panel and click Connect.
Disconnect them if the resource, request, or linked method does not match the new one.
Click Next.
When a new resource, method, or request matches an existing one, ReadyAPI will update existing items with the new item’s data.
The existing items are removed if neither the existing resource nor its methods or requests match the new resource, method, or request.
ReadyAPI will notify the user if a new resource's methods and requests don't match existing items.
After you match all the required items, click Next.
Refactor properties
The Refactoring REST Definitions dialog box highlights the differences between the old and new versions. Examine the suggested modifications, and if necessary, modify the final version.
Indicate how ReadyAPI should handle representations for linked methods. If you want to maintain the current representations, select Ignore. If you want to replace them with the revised versions, choose Overwrite.
Choose whether ReadyAPI should remove the parameter or link it to one of the new parameters if a parameter is missing from the new definition.
Refactoring SOAP APIs
📝Note: You need the ReadyAPI Test license to use refactoring.
You can update the definition of the service in ReadyAPI to route requests to the appropriate interfaces.
Open the SOAP Refactoring Dialog
Use one of the following methods to open the SOAP Refactoring dialog box:
1️⃣Click on “Refactoring” on the ReadyAPI toolbar.
OR
2️⃣Select Refactor Definition by right-clicking the interface in the Navigator.
OR
3️⃣Select Refactor Definition by opening the API menu.
You'll see the Refactor Definition window.
Import the Definition
You can import the WSDL definition for refactoring in the Refactor Definition window and define refactoring options.
In the Definition URL edit box, type the URL of the definition file.
Use the following template to specify local files: file:/<path>.
Additionally, you can use the interface's Browse button to choose the file.
To make new requests based on the definition, select Create New Requests.
Before making the changes, choose to Create Backup to create a project backup.
The new WSDL is located and analyzed by ReadyAPI. Then, if necessary, you can choose how to map old operations to new ones.
Refactor Operations
You can connect old operations to new ones in the Transfer Operations window.
Old operations are on the left side, and new ones are on the right. ReadyAPI will try to automatically match existing operations with the new ones.
New operations are blue, and older activities are red.
Connect Operation:
Choose the new operation.
Select the old operation.
Go to Connect.
To remove incorrect associations:
Choose the new operation.
Choose the previous operation.
To disconnect, Click Disconnect.
Click Next once you've connected all of your necessary operations.
Refactor Messages
You can refactor the expected responses and request schema in the Refactor Schema box. You can change the namespace, rearrange the elements, change the characteristics of the elements, and vice versa.
The panel's interface is divided into three main sections:
Operations Panel
The tree view of each operation in the resulting definition is displayed in the Operations panel. The operations that ReadyAPI was unable to refactor will be highlighted in red. Both the requests in the ReadyAPI Test SOAP request step and the APIs node requests can be refactored.
Schema Panel
You can define the correlation between the existing and new schemas in the Schemas panel. The imported schema is displayed on the left side of the panel, while the current schema is displayed on the right.
Message Panel
You can view/edit the message in both the old and new schemas in the Message panel. To make the new message text more user-friendly, choose Pretty Print.
Update XPath Expressions
The XPath expressions in your project are impacted by changes to your API. Although ReadyAPI will try to update them automatically. But if there are major changes, you will need to manually add new XPath expressions.
Updating SOAP Request Test Steps
The interface request from the APIs node can be copied into one or more pre-existing SOAP Requests. One interface request can only be copied at a time.
Steps to update a SOAP Request:
1️⃣Select “Copy to Requests” by right-clicking on the SOAP request in the APIs node.
2️⃣In the following dialog box, configure the parameters:
From the Modes drop-down menu, click "copy".
Select which requests you want to copy the API to.
Select Create Backups if you need to create a backup of a request before making any changes. ReadyAPI will copy all updated requests.
To see a list of all modified requests, select Open Requests.
3️⃣Click OK.
Updating Kafka schemas
ReadyAPI uses schemas to serialize and deserialize Kafka messages. To update a schema:
Right-click the operation to perform in the Navigator.
SelectProtobuf Schema/Update Avro.
Select a new schema file in the next dialog box.
Frequently Asked Questions
Why is API testing required?
API testing is critical for ensuring that our API functions as intended when subjected to a wide range of expected and unexpected requests.
Is Ready API available for free?
Ready API is a no-code API testing platform that helps simplify your testing procedures. Download your free trial now to gain complete access to all testing features.
What is the most recent Ready API version available?
Ready API 3.41. 0 is the most recent release.
Is Ready API automation tool?
Ready API is a SOAP API, a REST automation testing tool.
Conclusion
In this article, we learned about updating and refactoring APIs in Ready API. We discussed the following: