From 30936ad6383115f1805b3c3206786e16f69a103d Mon Sep 17 00:00:00 2001
From: Philipp Theyssen
Date: Tue, 28 Feb 2023 12:13:55 +0100
Subject: [PATCH] Rewrite using returnValues
---
.../operations/op_catalog_get_items.json | 68 ++++++++++++++-
.../transactions/add_items_to_basket.json | 84 +++++++++++++++----
2 files changed, 130 insertions(+), 22 deletions(-)
diff --git a/scenario-definition/operations/op_catalog_get_items.json b/scenario-definition/operations/op_catalog_get_items.json
index bcc71db77..8f0bb9df8 100644
--- a/scenario-definition/operations/op_catalog_get_items.json
+++ b/scenario-definition/operations/op_catalog_get_items.json
@@ -11,19 +11,79 @@
"returnValues": [
{
"key": "item-1",
- "value": "@@response.payload.data[0]@@",
+ "value": "response.payload.data[0]",
"type": "object"
},
+ {
+ "key": "item-1-id",
+ "value": "response.payload.data[0].id",
+ "type": "string"
+ },
+ {
+ "key": "item-1-name",
+ "value": "response.payload.data[0].name",
+ "type": "string"
+ },
+ {
+ "key": "item-1-price",
+ "value": "response.payload.data[0].price",
+ "type": "unsignedInt"
+ },
+ {
+ "key": "item-1-avialable-stock",
+ "value": "response.payload.data[0].availablestock",
+ "type": "unsignedInt"
+ },
{
"key": "item-2",
- "value": "@@response.payload.data[1]@@",
+ "value": "response.payload.data[1]",
"type": "object"
},
+ {
+ "key": "item-2-id",
+ "value": "response.payload.data[1].id",
+ "type": "string"
+ },
+ {
+ "key": "item-2-name",
+ "value": "response.payload.data[1].name",
+ "type": "string"
+ },
+ {
+ "key": "item-2-price",
+ "value": "response.payload.data[1].price",
+ "type": "unsignedInt"
+ },
+ {
+ "key": "item-2-avialable-stock",
+ "value": "response.payload.data[1].availablestock",
+ "type": "unsignedInt"
+ },
{
"key": "item-3",
- "value": "@@response.payload.data[2]@@",
+ "value": "response.payload.data[2]",
"type": "object"
- }
+ }
+ {
+ "key": "item-3-id",
+ "value": "response.payload.data[2].id",
+ "type": "string"
+ },
+ {
+ "key": "item-3-name",
+ "value": "response.payload.data[2].name",
+ "type": "string"
+ },
+ {
+ "key": "item-3-price",
+ "value": "response.payload.data[2].price",
+ "type": "unsignedInt"
+ },
+ {
+ "key": "item-3-avialable-stock",
+ "value": "response.payload.data[2].availablestock",
+ "type": "unsignedInt"
+ },
]
"url": "http://localhost:5101/catalog-api/api/v1/Catalog/items"
}
diff --git a/scenario-definition/transactions/add_items_to_basket.json b/scenario-definition/transactions/add_items_to_basket.json
index 7aa59cfe3..be5b46ddf 100644
--- a/scenario-definition/transactions/add_items_to_basket.json
+++ b/scenario-definition/transactions/add_items_to_basket.json
@@ -5,7 +5,55 @@
{
"name": "user-id",
"type": "guid"
- }
+ },
+ {
+ "name": "item-1-id",
+ "type": "string"
+ },
+ {
+ "name": "item-1-name",
+ "type": "string"
+ },
+ {
+ "name": "item-1-price",
+ "type": "unsignedInt"
+ },
+ {
+ "name": "item-1-available-stock",
+ "type": "unsignedInt"
+ },
+ {
+ "name": "item-2-id",
+ "type": "string"
+ },
+ {
+ "name": "item-2-name",
+ "type": "string"
+ },
+ {
+ "name": "item-2-price",
+ "type": "unsignedInt"
+ },
+ {
+ "name": "item-2-available-stock",
+ "type": "unsignedInt"
+ },
+ {
+ "name": "item-3-id",
+ "type": "string"
+ },
+ {
+ "name": "item-3-name",
+ "type": "string"
+ },
+ {
+ "name": "item-3-price",
+ "type": "unsignedInt"
+ },
+ {
+ "name": "item-3-available-stock",
+ "type": "unsignedInt"
+ },
],
"operations": [
{
@@ -25,37 +73,37 @@
"value":
{
"id": "1",
- "productId": "@@op-1.response[0].id@@",
- "productName": "@@op-1.response[0].name@@",
- "unitPrice": "@@op-1.response[0].price@@",
- "oldUnitPrice": "@@op-1.response[0].price@@",
- "quantity": "@@op-1.response[0].availablestock@@",
+ "productId": "{{item-1-id}}",
+ "productName": "{{item-1-name}}",
+ "unitPrice": "{{item-1-price}}",
+ "oldUnitPrice": "{{item-1-price}}",
+ "quantity": "{{item-1-available-stock}}",
"pictureUrl": ""
},
},
{
"key": "item-2",
- "value":
+ "value":
{
"id": "2",
- "productId": "@@op-1.response[1].id@@",
- "productName": "@@op-1.response[1].name@@",
- "unitPrice": "@@op-1.response[1].price@@",
- "oldUnitPrice": "@@op-1.response[1].price@@",
- "quantity": "@@op-1.response[1].availablestock@@",
+ "productId": "{{item-2-id}}",
+ "productName": "{{item-2-name}}",
+ "unitPrice": "{{item-2-price}}",
+ "oldUnitPrice": "{{item-2-price}}",
+ "quantity": "{{item-2-available-stock}}",
"pictureUrl": ""
},
},
{
"key": "item-3",
- "value":
+ "value":
{
"id": "3",
- "productId": "@@op-1.response[2].id@@",
- "productName": "@@op-1.response[2].name@@",
- "unitPrice": "@@op-1.response[2].price@@",
- "oldUnitPrice": "@@op-1.response[2].price@@",
- "quantity": "@@op-1.response[2].availablestock@@",
+ "productId": "{{item-3-id}}",
+ "productName": "{{item-3-name}}",
+ "unitPrice": "{{item-3-price}}",
+ "oldUnitPrice": "{{item-3-price}}",
+ "quantity": "{{item-3-available-stock}}",
"pictureUrl": ""
}
}