# API Process

API Process Testing involves creating a chain of API’s and passing the response of one API as a request to the next one, running them together and viewing the results of the entire flow.

## Contents

* [API Process](#api-process)
  * [Introduction to API Process](#introduction-to-api-process)
  * [Project Creation](#project-creation)
  * [Test Suite Creation](#test-suite-creation)
    * [Creating a New Test Suite](#creating-a-new-test-suite)
    * [Editing a Test Suite](#editing-a-test-suite)
    * [Deleting a Test Suite](#deleting-a-test-suite)
  * [Test Suite Creation](#test-suite-creation-1)
    * [Import From Exisiting APIs](#import-from-exisiting-apis)
    * [Import from Swagger JSON or WSDL File](#import-from-swagger-json-or-wsdl-file)
    * [Import from Swagger JSON or WSDL Link](#import-from-swagger-json-or-wsdl-link)
    * [Import from Postman Collection](#import-from-postman-collection)
  * [Manage APIs](#manage-apis)
    * [Assertions in Manage API](#assertions-in-manage-api)
  * [Create Flow](#create-flow)
    * [Old Flow](#old-flow)
      * [Create Flow Guide](#create-flow-guide)
      * [Adding APIs to the Old Flow](#adding-apis-to-the-old-flow)
      * [Saving Connections](#saving-connections)
      * [Establishing Connection Configuration](#establishing-connection-configuration)
    * [New Flow](#new-flow)
      * [Adding APIs to the New Flow](#adding-apis-to-the-new-flow)
      * [Saving New Connections](#saving-new-connections)
      * [Establishing New Connection Configuration](#establishing-new-connection-configuration)
  * [Execute API Flow](#execute-api-flow)
    * [Execute as Functional Test](#execute-as-functional-test)
    * [Execute as Performance Test](#execute-as-performance-test)
  * [Reports](#reports)
    * [Functional Reports](#functional-reports)
    * [Performance Reports](#performance-reports)
      * [Response Time of API Flow vs. Thread Number](#response-time-of-api-flow-vs-thread-number)
      * [Response Time per API vs. Thread Number](#response-time-per-api-vs-thread-number)
      * [Status Code per API vs. Thread Number](#status-code-per-api-vs-thread-number)
  * [Advanced Features for API Process](#advanced-features-for-api-process)
    * [Report Actions](#report-actions)
    * [Parameterized Case](#parameterized-case)

## Introduction to API Process

The term **API Process** encapsulates the end-to-end sequence of steps involved in connecting, testing, and validating the functionality and performance of interconnected APIs. This process often includes configuring connection parameters, crafting test scenarios, executing API requests, analyzing responses, and generating relevant reports.

1. **Functional Testing in API Process:** During the API process, functional testing ensures that the interconnected APIs correctly exchange data, execute operations, and respond appropriately to various requests.
2. **Performance Testing in API Process:** In the context of the API process, performance testing aims to verify that the interconnected APIs can handle a realistic workload without compromising performance.

## Project Creation

[**Click here for instructions on how to Create Project**](https://docs.qyrus.com/api-testing/getting-started/project-creation-for-api)

## Test Suite Creation

### Creating a New Test Suite

To create a new Test Suite in API Process, follow these steps:

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-e04e2b975131f348fbc062e991bc58771482cd4b%2FcreateTestSuite1.png?alt=media)

Step-1 : Click on **Create Test Suite**

Step-2 : Enter **Test Suite Name and Description**

Step-3 : Click on **Create Test Suite**

NOTE:

* The Test Name can have only letters, numbers, and underscores.
* Module name should not exceed 225 characters

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-a5c2b7ccce7243b117c6a52c68f0510d468f8695%2FcreateTestSuite.gif?alt=media)

***

### Editing a Test Suite

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-d06ecdf8971d7283a445a54fe977a75c817bda10%2FupdateTestSuite1.png?alt=media)

Step-1 : Click on **Edit Test Suite**

Step-2 : Enter **Test Suite Name and Description**

Step-3 : Click on **update**

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-ba02ce8a136dac73150f91f26b66ee5b83f3656d%2FUpdateTestSuite.gif?alt=media)

***

### Deleting a Test Suite

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-0b03947306364d00677d02508b140503ea464dbf%2FdeleteTestSuiteCreation.png?alt=media)

Step-1 : Click on **Delete Test Suite**

Step-2 : Click on **Yes**

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-0f6057ca39ff123e8d5264ec2e9ad04762c6dec1%2FdeleteTestSuite.gif?alt=media)

***

## Test Suite Creation

### Import From Exisiting APIs

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-f0ce0612aa0779c46d655f1bd3f9711b392a6896%2FImportExisitingAPIs.png?alt=media)

Step-1 : Select the **Import from Existing APIs** option.

Step-2 : Select the necessary API's to be imported.

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-d1e14d01e3b06bf77fa652b17c53e17fb38671e8%2FImportFromExisting.gif?alt=media)

***

### Import from Swagger JSON or WSDL File

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-2af3c485bf61bb718bd8af8a8e9380af7f6dcfd8%2FswaggerJson.png?alt=media)

Step-1 : Select **Import from Swagger JSON or WSDL File** .

Step-2 : Click on **upload**.

Step-3 : Select the necessary API's to be imported.

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-a741656de507fa540bf373caca8bccafa2d98ca0%2FImportFromSwaggerFile.gif?alt=media)

***

### Import from Swagger JSON or WSDL Link

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-304a5ef5b1c634a353834a90854e67c4bef8af99%2FswaggerURL.png?alt=media)

Step 1 : Click on **Import from Swagger JSON or WSDL Link** option.

Step 2 : Enter the swagger JSON or WSDL Link.

Step 3 : Click on **GetAPI's**.

Step 4 : Select the necessary API's to be imported.

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-74ff25b22e6a8364ae9a773c8441072714416e5b%2FImportFromSwaggerURL.gif?alt=media)

***

### Import from Postman Collection

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-0b2b0fcc037f7f6395fa9227e874333cb6f48e53%2FpostmanCollectionJSON.png?alt=media)

Step-1 : Select the **Import from Postman Collection** option.

Step-2 : Upload your Postman Collection file using the provided upload functionality.

Step-3 : Select the necessary API's to be imported.

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-8bc3ae0328561dc85c57a8ed9eee81161d97505d%2FImportFromPostmanCollection.gif?alt=media)

***

## Manage APIs

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-b61aedde918d3f2a98619e6eaba331fea3e156c6%2FManageAPI's.png?alt=media)

Step-1 : Navigate to the **Manage API's**

Step-2 : Locate the API you want to edit and click on it to open its details.

Step-3 : Look for the **Edit** Option.

Step-4 : Make the necessary changes to the API details, such as endpoint URLs, headers, and parameters.

Step-5 : After making all necessary edits, save the changes.

Step-6 : Similarly, find the API you want to delete and select it.

Step-7 : Look for the "Delete" option and confirm your decision.

***

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-837f45ef1ccaa6e0a82f61aa057b3ef46a91537b%2FManageAPI's.gif?alt=media)

***

### Assertions in Manage API

[**Click Here for instructions on how to perform Assertions in Manage API's.**](https://docs.qyrus.com/api-testing/functional-testing/functional-assertions)

***

## Create Flow

### Old Flow

#### Create Flow Guide

This Flows enable you to sequence test scripts and establish connections between them to model complex API processes.

#### Adding APIs to the Old Flow

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-3dd01a4ef861ec5c5367a638048205aea423539a%2FoldflowFigma.png?alt=media)

Step-1 : Select the Existing API to be added the flow.

Step-2 : On the top we have toggle to switch between new flow and old flow by default it is old flow

Step-3 : select the API's to added to the canvas

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-af2cbb6a4e570460ac89cd5cb1b15a3fdc899dbe%2FoldFlow.gif?alt=media)

***

#### Saving Connections

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-ceba76bc30780edea7bfa7f34aac51d3383a4688%2FsaveConnectionold.png?alt=media)

Step-1 : After adding the API's to the canvas then click on **Add Connection** will help to configure the connection.

Step-2 : Choose the target API's that the current API's needs to connect.

Step-3 : Click **Save** to save the configuration.

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-cf7b42ef2d9122b10e29c94e4ff6bf9b70a169c3%2FsaveOldFlow.gif?alt=media)

***

#### Establishing Connection Configuration

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-4deef402c24f64d0fc0acbd228fee65d4d97a286%2FsaveoldConnectionConfig.png?alt=media)

Step-1 : Once connections are saved, navigate to the next page in the flow creation process.

Step-2 : Here, you'll see the list of connections you've created.

Step-3 : Click on a connection to configure its behavior:

* Set up the conditions for the connection to activate.
* Define parameter type to pass from one API to another.
* Linking APIs involves using extracted data from one API's response to enhance another API's request.
* This is achieved by specifying parameter types (query, path, header, request body, or request key) and their corresponding JSON paths.
* **Query Parameter:** Extract data from the first API response using JSON path and pass it as a query parameter in the second API call.
* **Path Parameter:** Replace part of the second API's URL path with data extracted from the first API using JSON path.
* **Header Parameter:** Take data from the first API response and use it as a header in the second API request.
* **Request Body:** Utilize the entire JSON object extracted from the first API response as the request body in the second API call.
* **Request Key:** Authenticate both APIs using a token extracted from the first API's response, ensuring secure communication.

  **Path Extraction**

  [**Click Here for instructions on how to perform Assertions in Manage API's.**](https://docs.qyrus.com/api-testing/api-process-advanced-features#path-extraction)

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-05ada0e4d92682acd68b80c16e592b325257e416%2FsaveoldConnectionConfig.gif?alt=media)

***

### New Flow

#### Adding APIs to the New Flow

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-987369c71e25eab0e1477d83fba085de5f48b3aa%2FNewflowAPIs.png?alt=media)

Step-1 : we will have to rebuild the test in case you choose to switch to new experience

Step-2 : Select confirm to enter new flow

Step-3 : Select the API's to added to the canvas.

​ ![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-ef73f3e0e53652256143bb2dccfd8a8b035c6558%2FnewFlow.gif?alt=media)

***

#### Saving New Connections

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-3f3cb1d6a1880c94550738da641c753a4c3711f5%2FsaveNewExperince.png?alt=media)

Step-1 : Drag and drop and API's to the canvas.

Step-2 : Choose the target API's that the current API's needs to connect.

Step-3 : Click **Save** to save the configuration.

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-88a02b7113017c7f8663b2254cdd35b5eebe3378%2FsaveNewFlow.gif?alt=media)

***

#### Establishing New Connection Configuration

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-f446512f3f218f43bc8ca0dae55b56a8f7689c2f%2FsaveConnectionConfigNew.png?alt=media)

Step-1: Click on a connection to configure its behavior:

* Set up the conditions for the connection to activate.
* Define parameter type to pass from one API to another.
* We do support multiple parameter type like query,path,request body,request key.
* By default it will be none.
* JSON path is represented as "$json" same syntax to be followed for entering jsonpath.

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-fc19fa25a0d35dcd3ee7c5b75975eaea49d0dd55%2FsaveNewConnectionConfig.gif?alt=media)\
​
-

## Execute API Flow

### Execute as Functional Test

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-7211b76a2e3997bf3ba0a4222d3278e1ea75c919%2FExecuteAsFunctional.png?alt=media)

Step-1 : After updating the connection configuration the click on run icon.

Step-2 : In the dropdown menu select the enivronment.

Step-3 : In the dropdown menu labeled Run As, choose **Functional**.

Step-4 : Click on the **Execute Test** button.

Step-5 : It will be navigated to reports page.

​\
![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-b704da53e68758106447429bc237ac8b54f58e7d%2FExecuteFunctional.gif?alt=media)

***

### Execute as Performance Test

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-f4bd78bf59a3f3abfb80551f9e2687abf4582261%2FexecuteAsPerformance.png?alt=media)

Step-1 : After updating the connection configuration the click on run icon.

Step-2 : In the dropdown menu select the enivronment.

Step-3 : In the dropdown menu labeled Run As, choose **Performance**.

Step-4 : select number of threads.

Step-5 : select Thresold response time.

Step-6 : Click on the "Execute Test" button.

step-7 : It will be navigated to reports page.

## ![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-32f700c987d06a875967279d4544ad11656726a9%2FExecutePerformance.gif?alt=media) ​

## Reports

### Functional Reports

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-45fb608603d802301b72abeacf499b3866b1d331%2FFRVD.png?alt=media)

Below is an explanation of the data fields present in the functional test report

| Field               | Description                                                |
| ------------------- | ---------------------------------------------------------- |
| Status              | The execution status of the test case (e.g., Pass, Fail).  |
| Body\_Assertion     | Assertion status for body content validation.              |
| DataHandler         | Data handling information or transformations applied.      |
| StatusCode          | The HTTP status code returned by the API endpoint.         |
| url                 | The URL of the API endpoint that was tested.               |
| TestCase\_Name      | The name or identifier of the test case.                   |
| jsonPath\_Assertion | Assertion status for JSONPath validations.                 |
| Header\_Assertion   | Assertion status for header content validation.            |
| ResponseTime        | The time taken for the API request and response.           |
| Response\_Body      | The response body received from the API endpoint.          |
| MethodName          | The HTTP method used in the API request (e.g., GET, POST). |
| Response\_Headers   | The headers included in the API response.                  |

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-695251971b268c058cf58025fbeb1e0fb38cce6e%2FFunctionalReports.gif?alt=media)

***

### Performance Reports

![image](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-d7cb283154930e9001dd7ffb9c68eeab867620a6%2FPerformanceReports.png?alt=media)

In the performance test report, you will find three key graphs that provide insights into the performance of the API flow under different thread loads.

#### Response Time of API Flow vs. Thread Number

This graph illustrates the relationship between the response time of the API flow and the number of concurrent threads. It helps you understand how the system's performance changes as the thread load increases. A higher thread count may result in increased response times, indicating potential performance bottlenecks.

***

#### Response Time per API vs. Thread Number

In this graph, you can see the response time of individual APIs within the flow plotted against the number of threads. This allows you to pinpoint APIs that might experience performance degradation under heavy loads. Identifying APIs with rising response times can help in optimizing their performance.

***

#### Status Code per API vs. Thread Number

The third graph showcases the distribution of status codes (e.g., 200 OK, 500 Internal Server Error) for each API across varying thread numbers. Analyzing this graph can provide insights into how the system responds to different thread loads. Unusual patterns, such as an increase in error codes, can indicate issues affecting specific APIs.

![gif](https://2173886669-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrWgLy70uByJZz2Zz3InN%2Fuploads%2Fgit-blob-a0dd5aab4b0fdda874f76cf08747a595ad963757%2FperformanceReports.gif?alt=media)

***

## Advanced Features for API Process

### Report Actions

[**Report Actions**](https://docs.qyrus.com/api-testing/api-process-advanced-features#report-actions)

### Parameterized Case

[**API Process Parameterized Case**](https://docs.qyrus.com/api-testing/api-process-advanced-features#parameterized-case)

***

[**Quick Go through of API Process**](https://docs.qyrus.com/api-testing/api-process-testing/quick-go-through-to-api-process)
