API Testing
Documentation Home
  • Overview
  • Getting-Started
    • Intro-to-API
    • Table of Contents
  • Project-Setup
    • Certificates
    • Database Configuration
    • Global-&-Environment
    • Integration
    • Pre-requisite-API
    • Project Set Up
  • Functional-Testing
    • API to DB Assertion
    • Advanced Features
    • Build-Test-Script
    • Functional Assertions
    • Functional-Testing
    • 🎀Parameterization
    • Functional Reports
  • API-Process-Testing
    • Advanced Features
    • API Process
    • Getting Started
    • Performance-Testing
      • Performance Testing
  • Advanced-Features
    • Emailing & Downloading Report
    • Execute JavaScript
    • Nova AI Assertions
    • Advanced Reports
    • Xray Integration
  • FAQ
    • FAQs
Powered by GitBook
On this page
  • Functional API Assertions
  • Assertions on SOAP API:
  • Multiple Assertion Options
  • Execution of API Assertion
  1. Functional-Testing

Functional Assertions

PreviousBuild-Test-ScriptNextFunctional-Testing

Last updated 1 year ago


Functional API Assertions

  • Functional assertions in API testing involve validating various aspects of an API's behavior, functionality, and responses to ensure that they meet the expected criteria.

  • Assertions on REST and GRAPHQL API:

a. Assertion on Headers (REST):

  • Assertions on headers help ensure that your API responses adhere to the specified standards.

    Step-1: Click on Assertion on Headers

    Step-2: Click on "Add" to include a header..

    Step-3: Choose desired operation in the dropdown menu and Provide the expected value in the "value" field.

    You can remove headers by clicking on the delete icon.


b. JSON Path Assertion (REST):

  • JSON Path assertion is a technique employed in Qyrus API testing to validate precise values within a JSON response.

    Step-1: Input JSON body in the JSON path extractor and click on extract.

    Step-2: Copy the JSON path you want to use and paste it into the designated "path" field. Provide the expected value in the "value" field, and then choose the desired operation from the dropdown menu to Extract.

    You can remove JSON Path Assertion by clicking on the delete icon.


c. Assertion on Body (REST)

  • Assertions on the body allow users to ensure that the data returned by the API meets the intended specifications

    Step-1: Select the appropriate assertion Type from the dropdown menu.

    Step-2: Enter the Expected Value corresponding to the selected assertion type.

    Assertions on body can be removed by clicking on the delete icon.


d. Schema Validation (REST)

  • Schema validation in API testing refers to the process of verifying whether the structure and data of an API response conform to a predefined schema or structure.

    Step-1: To use that, add JSON body in Schema Generator Section.

    • Click on Generate button and copy the Schema Response and use it in Schema Validation.


Assertions on SOAP API:

a. Assertion on Headers (SOAP):

Step-1: Click on Assertion on Headers

Step-2: Add a header.

Step-3: Choose desired operation in the dropdown menu and Provide the expected value in the "value" field.


b. XPath Assertions (SOAP):

Step-1: Add XML Body inside XPath extractor and click on extract.

Step-3: Copy the path you want to use and paste it into the designated "path" field. Provide the expected value in the "value" field, and then choose the desired operation from the dropdown menu to Extract.

XPath Assertions can be removed by clicking on the delete icon.


c. Assertion on Body (SOAP)

  • Assertions on the body allow users to ensure that the data returned by the API meets the intended specifications

    Step-1: Select the appropriate assertion Type from the dropdown menu.

    Step-2: Enter the Expected Value corresponding to the selected assertion type.


d. Schema Validation (SOAP)

  • Schema validation in API testing involves verifying that the actual responses received from an API match a predefined schema or structure.

Step-1: Copy the response and paste it in Schema Generator Section.

Step 2: Clicks on Generate button and copy the Schema Response and use it in Schema Validation.

Step-3: Save and Run the test script.


Multiple Assertion Options

Xpath and Json Assertions

Json and Xpath Path Assertions also performs

  • Contains: Verifies that a specific value or pattern is present within the JSON response.

  • Does Not Contain: Ensures that a particular value or pattern is absent in the JSON response.

  • Equals To: Compares a JSON value with an expected value for exact match.

  • Not Equals To: Checks if a JSON value is not equal to a specified value.

  • Less Than: Validates if a numeric JSON value is less than a given value.

  • Greater Than: Validates if a numeric JSON value is greater than a given value.

  • Not Null: Verifies that a JSON value exists and is not null.

  • Regular Expression: Enables validation using regular expressions for complex matching requirements.

  • JavaScript: Allows you to perform custom validation using JavaScript expressions.


Assertion on Body

Assertion on Body also performs:

  • Contains: Verifies that a specific value or pattern is present within the JSON response.

  • Regular Expression: Enables validation using regular expressions for complex matching requirements.

  • JavaScript: Allows you to perform custom validation using JavaScript expressions.


Execution of API Assertion

Assertion on Headers (SOAP)
XPath Assertion (SOAP)
Assertion on Body (SOAP)
Schema Validation (SOAP)
Functional API Assertions
Assertions on REST & GRAPHQL API
Assertions on SOAP API
Multiple Assertion Options
Xpath and Json Assertions
Assertion on Body
Execution of API Assertion
Assertion on Headers (REST)
JSON Path Assertion (REST)
Assertion on Body (REST)
Schema Validation (REST)
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
Execute API assertion