Database Configuration

This feature is designed to test REST APIs that store data into databases. Validation that the API is functioning properly is made by comparing elements of the request body of the API to values retrieved from a database query.

Once sucessfully configured a database, an user can use that for database assertion in Functional test script.

Contents


Get started with Database Configuration:

Step-1: Select a project.

Step-2: Under any Functional, Performance or API Process service, click on Project Setup.

Step-3: Under Project Setup, click on Database Configuration.

Database Configuration

Step-4: There will be a list of all the Databases or if not we can create as required.

Step-5: Click on New Configuration.

New Configuration

Step-6: Choose Database type & set the Configuration Name.

Database Types
  • Based on database type, required fields may differ.

  • Available databases are Oracle, MySQL, Snowflake, Netezza, DB2, DynamoDB, Lambda Function & Redshift.

Step-7: If an user selects MySQL as type. Provide Hostname, Port number, Database name, Username & Password.

Database Save

Step-8: Then click on Save.

Step-9: Click on Test Connection to ensure configuration is valid or not.

Test Connection

Editing a Database Configuration:

Step-1: Within the Database Configuration section, find the database configuration you wish to edit.

Databases

Step-2: Click on the card of the configuration to be able to edit its details.

Step-3: Once you've made the necessary modifications to the configuration, proceed by clicking on the Save button or click the Cancel button to discard any changes..

Update Databases

Deleting a Database Configuration:

Step-1: Within the Database Configuration section, find the database configuration you wish to delete.

Step-2: Click on the Trash Can icon & Delete Database Configuration tab will get displayed.

Delete

Step-3: An user can confirm deletion hitting Yes button.

Delete

Build an API to DB Test

Step-1: In Functional Testing, click on the Add API button to create a test manually or import the API information from any of the available import options. Click on Go to Test button to edit any existing APIs.

Step-2: Make sure all the information required to call the API is added.

Step-3: Under Assertions tab, change toggle to Database Assertion .

Note :

  • Test is parameterized

  • API type is not Rest

Step-4 : Select assertion on body type either on response or request body.

Assertion On Body

Step-5: Select a database configuration from the dropdown.

Database configuration

Step-6: Enter a SQL statement in the Database statement section that returns one result set and contains the data to be compared with the API request body or respone body.

Database Statement
  • Note: Make sure the query is valid and returning the result you expect. There are no checks to make sure the query is valid.

Step-7: Create the database assertions & then Save and Run script.

Step-8: On result page

Database Result

Last updated