Understanding API Parameterisation
Last updated
Last updated
API Parameterization is the process of dynamically inputting values into API requests during test execution. It allows you to test APIs with various input combinations, ensuring comprehensive coverage and identifying potential issues that might not be detected with static values.
Dynamically data drive your API by parameterising the API request. To parameterise type '{{' to get the list of parameters.
You can add a local parameter to data drive the API request and provide the test data manually
Global parameter would be used when you have stored the value globally for easy management and reuse across multiple test cases.
For Example: Endpoint URI would be a constant which would be used globally across multiple test cases in a project.
In the above Endpoint URI, it can be parameterised with a global parameter as
In this case, 'Endpoint_URI' would be a global parameter with a constant value 'https://reqres.in/api/users'.
Runtime Parameters would be used to extract values from previous API responses or generate dynamic data and use them as parameters in subsequent calls.
Example 1 : In case of Login API, you would be receiving a authentication token in the API response. You can the token from the API response and store it in a runtime parameter. Now you can use this runtime parameter in subsequent API call or any other test case.
Example 2 : If a data has to be dynamically generated such as, userID or orderID to get a realistic data - generated data would be stored in a runtime parameter. Now you can use this runtime parameter in subsequent API call or ay other test case.
Additional Tips
Clear Naming Conventions: Use meaningful names for parameters to improve readability.
Data-Driven Testing Best Practices: Follow best practices for designing and managing data-driven test cases.
Environment Variable Management: Securely manage sensitive parameter values in environment variables.