In API testing, you often need to run the same test with different input data. Parameterization makes this possible without duplicating your tests. It allows you to replace hard-coded values in your API calls with dynamic placeholders, making your tests reusable, easier to maintain, and enabling powerful data-driven testing.
In ACCELQ, you can parameterize almost any part of your API request, including the URL, headers, and payload.
Parameterizing the Request Payload
The request payload is the data you send with your API call, and it's the most common area for parameterization. ACCELQ offers two convenient modes for editing the payload, and both fully support parameterization.
Text Mode
The text mode gives you a raw editor for your payload. To insert a parameter:
- Place your cursor where you want the dynamic value to be.
- Type
{{$. - A context-aware menu will instantly appear, listing all available parameters, such as Global Properties and Action Parameters.
- Select the desired parameter from the list. ACCELQ will insert the correct placeholder syntax into your payload.
Outline Mode
The outline mode provides a structured, user-friendly view of your payload, which many users find easier for parameterization.
- In the form view, locate the field you wish to parameterize.
- Click on the value input box for that field.
- A dropdown menu will appear next to the value. Click it to select the parameter type:
- Static value: A regular, hard-coded value.
- Global Property: A value defined at the project level.
- Action Parameter: A parameter passed into the current action.
- Local Parameter: A parameter defined within the current action.
- Once you select a type, you can then choose the specific parameter you want to use.
Parameterizing URLs and Headers
Parameterization isn't just for the payload. You can apply the same dynamic approach to other parts of your request.
- Endpoint URL: Make your endpoint dynamic by inserting parameters for things like resource IDs or query strings.
- Request Headers: Parameterize values for headers like authorization tokens (Auth-Token) or session IDs to easily switch between different users or environments.
Comments
0 comments
Please sign in to leave a comment.