Get Key value
Last updated
Was this helpful?
Last updated
Was this helpful?
This is pre-built Action located under the @Generic Element Name. It instructs the Avo Assure Client to fetch the value of the specified key from the input and save the result in the given output variable.
Syntax:
Input: <input_json>;<block_key_name>;<block_count>;<key_name>
Output: <Dynamic Variable>(Optional);<Dynamic Variable>(Optional)
Usecase/Example:
Scenario: Fetching Product Details from E-commerce API In an e-commerce application, users can browse a catalog of products. Each product has specific details, including its name, price, and availability status. The application relies on a backend API to provide this information dynamically. As part of the testing process, it's crucial to ensure that the API correctly returns the expected product details when queried. This ensures that users receive accurate information, which is essential for their purchasing decisions. In this scenario, we will test the API that retrieves details for a specific product by its unique identifier, productId. The goal is to verify that the API responds with the correct data in JSON format.
Testing Example:
Input
json
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{
"productId": "12345",
"name": "Wireless Headphones",
"price": 99.99,
"availability": true,
"attributes": {
"color": "black",
"weight": "0.5 lb"
}
}]
}
}}
Using the Action:
Execute the GET request to the API.
Use the action get key value for JSON to extract the following: name
Expected Result:
This Action need to extract name as "Wireless Headphones".
Output: The result is stored in the {result} output variable as Wireless Headphones, which can be utilized for display or other purposes.