Parameterization
Parametrization in API testing refers to the practice of using parameters or variables to make API requests and responses more flexible, reusable, and versatile.
It involves replacing specific values in API requests and responses with variables, which can be dynamically populated with different values during testing or execution. Parametrization enhances the flexibility and adaptability of your tests, allowing you to test various scenarios using a single set of test cases.
Contents
Parameterization
Create a Parameterized API
Execution & Reports
Make Individual Field Parameterized
Sample XML Template
Related Topics
Create a Parameterized API:
In this guide, you'll learn how to perform parameterized API testing.
Step-1: Navigate to Functional Testing.
Step-2: Build a Test Script.
Click on to getting started with building a Test Script
Step-3: Switch "Make API Parameterized" switch to on.
This toggle is disabled if any of the following is true:
Database Assertion is on.
Step-4: After that, make sure to save the test and then click the Parameter button at the top-right and then Parameterized popup will get displayed.
Step-5: Then click on the Download JSON or Download Excel or Download XML button to download file.
Note :
For SOAP API, Download XML will be displayed.
For REST API, Download JSON will be displayed.
For SOAP, GraphQL & REST API, Download Excel will be available.
Step-6: After downloading file open that file.
Now fill the value in fields
Step-7: Now save the file and Upload template by clicking on the Browse button.
Step-8: After browsing the template, click the Submit button to upload template. Now we are all good to run the API Test.
Note :
If scripts are parameterized in functional or performance or API process tests, make sure to save script once before downloading parameterized file.
Execution & Reports
Ensure the tests have been saved before execution.
Step-1: Click the Play button at the top-right to execute this parameterized API test.
Step-2: Navigate to the reports by clicking the "Reports" button at the top-right as well and go to the "Test Result" tab.
Step-3: Find the test at the top, click View Details.
Multiple reports are available on this page for each test case identified in the parameterization file as
Test -1
Test -2
Make individual field as parameterized
User can make an individual field as parameterized rather than making the whole API as parameterized.
User will be able to make the following fields as parameterized:
Headers
Path Parameters
Query Parameters
Assertion on headers
JSON path assertion
Assertion on body
Schema validation
Let’s see how it works!!!
Step 1: First, toggle on Make API parameterized from the info tab to use this feature.
Step 2: Then, go to the Header & Params tab.
Step 3: In this tab go to the Header or Path parameters or Query parameters, there’ll be one column as Parameterized.
Step-4: After that, make sure to save the test and then click the Parameter button at the top-right and then Parameterized popup will get displayed.
Step-5: Then click on the Download JSON or Download Excel or Download XML button to download file.
Step-6: After downloading file open that file.
Now fill the value in fields
Step-7: Now save the file and Upload template by clicking on the Browse button.
Step-8: After browsing the template, click the Submit button to upload template. Now we are all good to run the API Test.
Step-9: Ensure the tests have been saved before execution. And click the Play button.
Navigate to the reports by clicking the "Reports" button at the top-right as well and go to the "Test Result" tab.
Find the test at the top, click View Details.
Multiple reports are available on this page for each test case identified in the parameterization file as
Test -1
Test -2
Test -3
Sample XML Template
Sample XML Template
Sample XML Template when individual field as parameterized:
Click here for API Process Parameterization
Related topics
API To DB Assertion
Emailing & Downloading Report