API Testing in TOSCA – An Excellent Guide for Tosca 13.x

API Testing in Tosca

Tosca Tutorial – Table of Content

Tosca is now become one of the leading test automation tool which follows the script less methodology. Through out the entire Tosca tutorial, we have already learned about the different Tosca components and test automation approach. Now we are going to explain the concepts of API Testing in TOSCA.

Tosca Tutorial #1: Tosca Overview

Tosca Tutorial #2: Tricentis Tosca Setup – Install, Uninstall and License Configuration

Tosca Tutorial #3: Tosca Workspace Creation

Tosca Tutorial #4: Understanding of TOSCA Commander and Tosca User Management

Tosca Tutorial #5: Tosca Scanning – An Introduction to Modules

Tosca Tutorial #6: Tosca Test Case Creation

Tosca Tutorial #7: Tosca Parameters and Library– Buffer, Business Parameter, TCP

Tosca Tutorial #8:Tosca Test Execution, Reports, and Bug management

Tosca Tutorial #9: Test Case Design – An approach to test data management 

Tosca Tutorial #10: Tosca Test Data Management.

Tosca Tutorial #11: API Testing in Tosca

Tosca Tutorial #12: Tosca Interview Questions and Answers

In this “API Testing in TOSCA” article, we will explain the overview of API and the detailed steps of automated API Testing in TOSCA.

API Testing in Tosca

What is API?

API is the shorter form of Application Program Interface. It’s working as an interface which allows two applications to communicate with each other through common message formats such as, XML, JSON, etc. Let’s consider the below figure to understand more on API–

Assume, we have four different applications – SAP App, Mobile Apps, Web Portal and Billing System, which are integrated by common interface as API. Here API is working as an interpreter. Each of the system interacting with each other by sending an API request and receiving the API response. Basically, each system is communicating with API and based on the request, API routes the messages to the target system.

API Testing in Tosca - Overview
API Testing in Tosca – Overview

Purposes of API:

  • Communicate between different applications.
  • It’s platform-independent.
  • Development of one system is not dependant with another.
  • Fast and secure communication.
  • Easy to integrate many applications.

Different Types of API:

REST API (Representational State Transfer): It’s a web service API which is now an essential part of modern web-based applications such as, Facebook, Netflix, etc. REST API should comply with below standards –

  • Stateless – It does not allow to store the data they received from a requestor.
  • Client-Server Architecture – Client and Server’s REST APIs should be independent with each other.
  • Cache – The cache is storing the browsing data for a specific period of time.
  • Uniform Interface – Communication should be HTTP requests using URL, CRUD(Create, Read, Update, Delete) and JSON.
  • Layered System – REST APIs should use different architecture layers which contributes towards a clear hierarchy.
  • Code on demand – It’s an optional rule to transmit code within the application through the API.

RPC API (Remote Procedure Call): These are the simplest API which is used from old days. The aim of RPC is to execute code on the server system. It was easier for application developers to develop applications involving more programs or services in the RPC API.

There are two types of RPC APIs – XML-RPC and JSON-RPC.

SOAP API (Simple Object Access Protocol): It is also one kind of web API. SOAP is the first to define the process about the applications to use a network connection to manage services. It’s a special protocol which is defined by the World Wide Web Consortium (W3C).

API Testing in TOSCA:

Before understanding the API Testing in TOSCA, first, we need to understand the “What is API Testing?”.

What is API Testing? 

The API Testing is an approach to test the API components of any software product in efficient way. To perform API testing, we need to validate the API response received based on the API request. The main moto of API testing is to test the core functionality, reliability, performance and security through the API. API Testing is ideal for testing the core functionality of the application when the all the application is partially developed. So, it allows us to start the testing before the integration of the software components.

For more information on API Testing, please click here.

API Testing in TOSCA:

The goal of API testing is to ensure that the core functionalities of the application work as expected without interacting in the UI layer. To perform the API Testing, always, we need to take help from any third party tools like Postman, UFT, TOSCA, etc.

Here, TOSCA is one of the best automation tools for API Testing.

Benefits API Testing in TOSCA:

  • API testing can be used to validate the core functionalities even when the UI hasn’t been developed/modified. Hence testing can be initiated much before actual functional testing (UI based) is done.
  • Frequent application changes can be tested quickly. 
  • It is easy to maintain test cases in TOSCA.
  • The API testing in TOSCA can be done much faster.
  • Standalone Tosca API Scanning Wizard is available to scan the API in the easiest way.
  • Easy to create Tosca test scenarios.

Supported Standards for API Testing in TOSCA:

Web Service StandardsSOAP 1.1, SOAP 1.2, REST
Transport LayerHTTP 1.1, IPv4, IPv6
Message FormatXML, JSON
Message Description LanguageOData 4.0, SWAGGER, WSDL 1.1, WADL, XSD, JSON Schema
AuthenticationBasic Authentication, Kerberos/SPNEGO, NTLM

Process flow for API Testing in TOSCA:

API Services – Identify the API details and functional flow for automation.

API Scan – Scan the API and create Tosca modules.

Create Test Case – Generate test cases and perform cleanup with parameterization.

Run – Execute the test cases and share the reports to stack holders.

API Testing in Tosca - Process Flow
API Testing in Tosca – Process Flow

Step by Step Guide to Perform Automation of API Testing in Tosca:

Step1# Collect API Details – We need to collect below API Information of the sample application,

Step2# Identify Scenarios and data formats for the API Request.

Test Scenario – After logging into the sample swagger application, need to add a new coffee brand and verify.

Data Format – Data need to be passed through JSON format.

Step3# Manually Verify the scenario using tools like Postman (Optional). Please go through the article on Postman to understand the process to test the API.

Step4# Scan the API with the endpoint reference. Scanning steps are mentioned below –

1) Open the API Scan wizard from “API Testing” tab available in TOSCA Header section.

2) Click on URI button and enter the endpoint address. Now click on OK to start scanning.

API Testing in Tosca - Scan API
API Testing in Tosca – Scan API

3) After a few moments, API scan will be completed, and scanned API modules are displayed in the API Scan Wizard.

API Testing in Tosca - Scanned Components
API Testing in Tosca – Scanned Components

Step5# Create modules and test cases – Selecting the root folder, i.e. “Swagger Demo CoffeeShop V2”, click on “API Test Case” to generate modules and test cases in the TOSCA. For every transaction, there are two parts – one for request and another for the response.

API Testing in Tosca - Generated Modules
API Testing in Tosca – Generated Modules

Step6# Cleanup scenarios: Auto-generated test cases can be used as a base suite which needs to be cleaned by removing the unwanted folders, create module attributes to parametrize the response values such as, authentication token which will be required to perform any transaction.

Post Coffee (Modules for API Request) –

API Testing in Tosca - Modules after Cleanup
API Testing in Tosca – Modules after Cleanup

After assigning the parameters, the API Test Case will look like below,

API Testing in Tosca - Test Case
API Testing in Tosca – Test Case

Step7# Execute API Test Case in TOSCA – First of all, we need to add the newly created test case into the execution list. Now, the execution can be initiated by clicking on “Run” button. As it’s an API Testing, no application UI will be visible through out the execution. After completion of execution, Report will look like below, 

API Testing in Tosca - Execution Log
API Testing in Tosca – Execution Log

Conclusion:

In this “API Testing in TOSCA” article, we have learned about API and API Testing in TOSCA. To know more on API testing in Tosca from Tricenties support portal, please click here.

About K Mondal

Hi, I am K. Mondal, I am associated with a leading organization. I am having 12+ years of working experience across domains e.g., application development, automation testing, IT Consultant. I am very much interested in learning different technologies. I am here to fulfill my aspiration and currently contributing as an Author and Website Developer both in LambdaGeeks.
Connect to LinkedIn- https://www.linkedin.com/in/kumaresh-mondal/

Leave a Comment

Your email address will not be published. Required fields are marked *