API Testing – SoliteraTA

SoliteraTA

View Categories

API Testing

Introduction

APIs serve as the backbone for communication between various software components, enabling seamless integration and data exchange. One crucial aspect of API testing is validating the functionality related to document creation. Whether it’s generating reports, composing text files, or storing user-generated content, the ability to create documents programmatically via APIs is a common requirement in many software systems. However, It’s not enough to just confirm that a document is created; it involves examining the API’s behavior under various circumstances to make sure it meets all sorts of functional, non-functional, and safety requirements.

Pre-Requisites for Execution API Script #

  • Good Internet Connectivity: Ensure a stable internet connection for seamless API testing.
  • Basic Knowledge of API Testing: Familiarity with API concepts and testing methodologies.
  • Understanding of API Functionality: Clear understanding of the specific API you intend to test.

Supported APIs #

1- REST (Representational State Transfer): – #

This is the most common type of web API. It uses standard HTTP methods (GET, POST, PUT, DELETE) and is stateless. It often exchanges data in JSON or XML format.

2-SOAP (Simple Object Access Protocol): – #

An older protocol that relies on XML and follows a strict set of messaging patterns. It’s more complex and has built-in error handling.

Supported Request Types #

In the context of web APIs, there are several types of HTTP request methods, each serving different purposes. These request types are essential for defining the actions to be performed on the resources available on the server. The main HTTP request types are: –

  • GET
  • PUT
  • POST
  • DELETE
  • HEAD
  • OPTIONS
  • TRACE

Supported Data Format #

APIs commonly use text formats such as JSON (JavaScript Object Notation) and XML (Extensible Markup Language) to transfer data between computers. JSON is a lightweight format that is easy to read and write and is often used for web APIs. XML is a more complex format that is often used for enterprise APIs. Other formats that APIs commonly deal with include HTML, JavaScript etc.

Supported Data format– Raw.

Supported content type: –

  • JSON
  • HTML
  • XML
  • Text
  • JavaScript

Supported Authentication Format:  #

In the context of web APIs, authentication is crucial to ensure that only authorized users or systems can access resources. Various authentication methods and formats can be used, each suited to different use cases.

Supported Authentication Formats are: –

  1. Basic
  2. Bearer

Application file Format: #

<environment>
 <config>
    <name>base_url</name>
     <type>api</type>
     <api_url>https://reqres.in/</api_url>
 </config>
 <environment>

Description of Elements of the Application file:

<environment>:

This is the root element, which encapsulates the entire configuration for the environment setup.

<config>:

This element contains all the configuration details for APIs connection.

<name>:

A name for this APIs configuration. It helps in identifying APIs configurations when multiple APIs are defined.

<type>:

Specifies the type of API.

<api_url>:

It defines the API URL that is used for testing.

By following this documentation, you can professionally and systematically test both SOAP and REST APIs using the SoliteraTA Tools. For more details of API step definition, click on this link.

https://soliterata.com/docs/test-script-module-b/step-def/#0-toc-title

Example of REST API Script #

Feature: Register_user

Scenario Outline: User will register
Given the base URL "base_url"
Then the API endpoint is "api/register" with request type "POST"
Then the format of sending data is "raw" with the raw data format being "json"
# Add the headers
Then add the following headers:
  |key|value|
  |Content-Type|application/json|
When the auth format is "NoAuth"
Given the request body contains data "<Reqres_Register_RT>"
# Execute the API
Then execute api contains current data
# Verify the response code,response body
Then verify response status code is "200"
Then verify response body contains "<Reqres_register_RespB>"
Then verify response body having starting key is "id" contains value "4"
Then verify response body having ending key is "token" contains value "<Token_ending>"
Then verify response body is starting key with "id"
Then verify response body is ending key with "token"

Examples: 
|Reqres_Url|Reqres_Endpoint|Reqres_Register_RT|Reqres_register_RespB|Token_ending|

Example of SOAP API Script #

Feature: Soap_API

Scenario Outline: user can reset password
Given the base URL "base_url"
Then the API endpoint is "/NumberConversion.wso" with request type "POST"
Then the format of sending data is "raw" with the raw data format being "xml"
# Add the headers
Then add the following headers:
    |key|value|
    |Content-Type|text/xml|
When the auth format is "NoAuth"
When the SOAP request body with the following XML details is "<soapAPI>"
# Execute the API
Then execute api contains current data
# Verify the response code,response body
Then verify soap response body contains data is "<soapAPIResponse>"
Then verify response status code is "200"
Examples: 
|soapAPIResponse|soapAPI|

Solitera may collect certain information by automated means, such as cookies and web beacons, when a user visits our website. A “cookie” is a small piece of data that a website can send to your browser, which may then be stored on your system. learn more