API Component
Last updated
Last updated
Welcome to the Component API Testing, a powerful tool designed to facilitate comprehensive testing of your APIs. This guide will walk you through the process of creating test steps for both REST and SOAP APIs, performing tests, and interpreting the results. Please follow the steps outlined below for effective utilization of the service.
Click on Select
to access the API component.
To begin, you have three options:
Go to Component and initiate the creation of test steps. Follow the below steps :
Component Page's Appearance varies for Designers and Reviewers
Provide the URL and click on Get API's
. This action will open a popup interface displaying all the APIs associated with that URL. You can select any number of APIs.
Click on Generate Component
After creation, components would look like this:
Click on Browse
and upload the required JSON file to create a test. Once after uploading the file, opens a popup interface display displaying all the APIs associated with that file. You can select any number of APIs.
Click on Generate Component
to create your test.
Click on Add
, a popup interface opens.
Provide the component name, module name, and component description.
Click on Create Component
to manually create the test.
After creation, components would look like this:
There are two types of APIs: Rest API and Soap API
Rest API :
In the Info
tab, select Rest API
and fill out the form
Context path - The base URL segment for an API's routes.
Protocol - HTTP and HTTPS, the communication standards for data exchange.
Endpoint - A specific URL that you can request data from or send data to.
Port Number - A numerical identifier for communication channels.
Verbs - GET, POST, PUT, DELETE, PATCH, representing different actions in API interactions.
Note that when selecting the GET verb, the Body
tab will be absent, but it will appear for the POST, PUT, DELETE, and PATCH verbs.
The Header & Params
tab includes sections for defining various parameters and values that are crucial for shaping interactions with an API:
Headers: This section allows you to specify custom HTTP headers to be included in the API request. Headers consist of key-value pairs that provide additional information about the request.
Path Parameters: Path parameters are used to define specific values within the URL path, allowing for dynamic and personalized resource identification in the API endpoint.
Query Parameters: Query parameters are added to the URL as key-value pairs, enabling the passing of data to the API endpoint. They contribute to the customization and filtering of the API response.
In order to properly test your API, you will need to add assertions to your script. Not adding any assertions will often result in passed tests, simply indicating that an API call was made. This will result in a False Positive. Clicking on the Assertions
button will open up a dropdown menu of different assertions you can make on your API response.
Assertion on Headers: This section facilitates specifying expected header values for validation, ensuring that the API response contains the correct headers with the provided values.
Json Path Assertion: Here, you can define assertions based on JSON paths. This validates specific data points within the JSON response, ensuring they match the anticipated values.You can extract JSON paths using the 'JSON Path Extractor' tool.The JSON Path Extractor
offers a convenient way to extract specific data from a JSON response:
Input JSON Body: Here, you can provide the JSON response body. This is the source from which you want to extract specific data points.
Clear Body: This option allows you to easily clear the input JSON body if needed.
Extracted Response: After applying a JSON path expression, this section displays the extracted data, which you can copy for further use.
Copy Response: This button simplifies the process of copying the extracted response for easy pasting. By populating the text field (Input JSON Body) with a valid JSON object and clicking on the "Extract" button, you will get a list of JSON paths that will navigate to the corresponding fields.
Assertion on Body: This section enables setting assertions on the response body, ensuring its content aligns with the expected values. It's particularly useful for validating textual or numerical data within the response. In this field, you only need to add a value that you wish to validate.
JSON Schema Generator: This feature is used to confirm the structure of your response. It allows you to input a sample JSON body and generate a schema that describes the structure of the JSON. Beware, you can encounter false positives with schema validation. Schema validation does not look for a one-to-one match, only that the provided schema can be found in the response body. Entering {} in the text field will yield a passing result.
Soap API :
Info
tab and Header & Params
are analogous to those found in Rest API. Additionally, in the Body
tab, XML format should be provided for request payloads.
Within the Assertions
tab, the options remain consistent except for :
XPath Assertions : XPath Assertions offer a structured approach for validating XML content. You can easily specify paths, types, and values to ensure accurate validation. Click 'Add' to include a new assertion. You can extract XML paths using 'XPath Extractor' tool XPath Extractor
simplifies extracting specific data from XML responses:
Input XML Body: Provide the XML response body from which data will be extracted.
Clear Body: Effortlessly clear the input XML body when necessary.
Extracted Response: After applying an XPath expression, view the extracted data here, ready for copying.
Copy Response: Quickly copy the extracted response for seamless use.
Schema Validation : This function lets you validate XML data against predefined schemas by inputting your XML data.
After creating the Test Steps, you can perform the following actions:
Save
- This action allows you to save the current configuration. It ensures that your test is preserved and can be accessed later.
Send For Approval
- With this feature, you can submit your component for review and approval by the reviewer.
Quick Run
- This option allows you to swiftly execute a test scenario without the need for an elaborate setup process. Upon initiating Quick Run, a popup interface will appear, prompting you to select the desired environment.
Upon initiating a run, comprehensive details can be accessed through the Notification Feed, offering three distinct content tabs for review:
Component info
- The content outlines essential information about the component's identity. It includes fields such as "Component Name," "Module Name," "Created On," "Modified On" dates and detailed description to specify the basic attributes of the component.
Tests
- Here, you will find tests associated with your components. Upon clicking Go to Test
, you will be directed to the relevant test. Click here to learn more.
Run Status
- When initiating a quick run, the status will be displayed here. Utilize the refresh button to periodically check the status. For comprehensive status information in case of a test pass or fail, simply click the 'View' button.
Clicking the 'View' button will open the 'Execution Summary Report', providing an overview of the execution details. It provides a concise overview of the outcomes and results of a test execution, highlighting key information such as test status, passed and failed assertions, response times, and any encountered errors or issues. This report serves as a valuable tool for quickly assessing the success and quality of the test run.
For Designer all the tabs will be displayed where -
My Components: Displays all created components.
Approved Components: Shows components approved by reviewers.
Awaiting Approvals: Presents components awaiting reviewer approval.
Rejected Components: Lists components declined by reviewers.
Draft Components: Encompasses components created but not submitted for review.
For Reviewers, the displayed tabs remain the same as those for Designers, with the exception that 'Approved Components' and 'Rejected Components' are consolidated under the 'All Components' tab.
And upon clicking Go To Component
for awaiting components, Reviewers will be presented with the option to either approve or reject the component.
Note that Clicking on Create Project
will open the same interface for both Designer and Reviewer as demonstrated in the Quick Start section. And components created by the Reviewer will be automatically approved when clicked on Send For Approval
.