You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deep-dive-into-hyperexecute-yaml.md
+93-47Lines changed: 93 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1016,72 +1016,118 @@ dataJsonBuilder:
1016
1016
```yaml
1017
1017
index: username
1018
1018
```
1019
-
- **filters (optional) :** Applies filtering on the JSON objects before indexing.
1020
-
- **query:** A logical expression to filter JSON objects based on their attributes. It supports complex queries using logical operators. Example:
1019
+
- **filters (optional) :** Applies filtering on the JSON objects before indexing. Either `query` or `attributes` can be used, if both are mentioned then the `attributes` will have higher precedence.
1020
+
- **query:** These are used for more complex filtering operations. If both attributes and queries are provided, attributes take precedence. This means that if there’s a conflict, the filter based on attributes will be used. Example:
1021
1021
```yaml
1022
1022
query: (username == "abc" or username == "bcd")
1023
1023
```
1024
-
- **attributes:** A list of key-value pairs to filter JSON objects. It has higher precedence over `query`. Example:
1024
+
- **attributes:** These are key-value pairs used for filtering. You can provide a list of attributes with their corresponding values, and the filtering will include only those JSON objects where each specified attribute matches one of the provided values. Attributes are applied with an "AND" logic between different keys and an "OR" logic within the same key. Example:
1025
1025
```yaml
1026
1026
attributes:
1027
1027
- key: username
1028
1028
value: ["abc", "bcd"]
1029
+
- key: tags
1030
+
values: ["@x", "@y"]
1029
1031
```
1030
1032
1031
-
#### Input data
1032
-
The input JSON data should follow this format:
1033
-
```javascript title="sample.json"
1034
-
[
1035
-
{
1033
+
#### Working of `dataJsonBuilder`
1034
+
1035
+
- The **input JSON data** should follow this format:
1036
+
```javascript title="sample.json"
1037
+
[
1038
+
{
1039
+
"accesskey": "jhscuystc7ewgucu79as8yc9",
1036
1040
"username": "abc",
1037
-
},
1038
-
{
1041
+
"tags": "@x"
1042
+
},
1043
+
{
1044
+
"accesskey": "cjdy87328yeiqhd93urd28hh",
1039
1045
"username": "bcd",
1040
-
},
1041
-
{
1042
-
"username": "def",
1043
-
},
1044
-
{
1045
-
"username": "def",
1046
-
}
1047
-
]
1048
-
```
1046
+
"tags": "@y"
1047
+
},
1048
+
{
1049
+
"accesskey": "jhscuystc7ewgucu79as8yc9",
1050
+
"username": "abc",
1051
+
"tags": "@y"
1052
+
},
1053
+
{
1054
+
"accesskey": "cjdy87328yeiqhd93urd28hh",
1055
+
"username": "bcd",
1056
+
"tags": "@a"
1057
+
}
1058
+
]
1059
+
```
1049
1060
1050
-
#### Output data
1051
-
The processed data includes additional fields `HYPERTEST_INDEX` and `HYPERTEST_CONCURRENCY` for indexing and concurrency information:
1052
-
```javascript title="sample.json
1053
-
[
1061
+
- **`dataJsonBuilder`** flag passed in the HyperExecute YAML file:
1062
+
1063
+
```yaml title="hyperexecute.yaml"
1064
+
dataJsonBuilder:
1065
+
path: sample.json
1066
+
filters:
1067
+
attributes:
1068
+
- key: username
1069
+
values: ["abc", "bcd"]
1070
+
- key: tags
1071
+
values: ["@x", "@y"]
1072
+
```
1073
+
1074
+
- The **filtered JSON data** will be:
1075
+
```javascript title="sample.json"
1076
+
[
1077
+
{
1078
+
"accesskey": "jhscuystc7ewgucu79as8yc9",
1079
+
"username": "abc",
1080
+
"tags": "@x"
1081
+
},
1082
+
{
1083
+
"accesskey": "cjdy87328yeiqhd93urd28hh",
1084
+
"username": "bcd",
1085
+
"tags": "@y"
1086
+
},
1087
+
{
1088
+
"accesskey": "jhscuystc7ewgucu79as8yc9",
1089
+
"username": "abc",
1090
+
"tags": "@y"
1091
+
}
1092
+
]
1093
+
```
1094
+
The objects with **usernames** `"abc"` and `"bcd"` and **tags** `"@x"` and `"@y"` are selected as they meet the criteria defined by the attributes filter.
1095
+
1096
+
#### Indexing and Test Case Distribution:
1097
+
After filtering, the JSON data is indexed to distribute test cases. Here’s how the distribution works:
1098
+
- **VM Allocation:** Each filtered JSON object corresponds to a separate VM. If the filtered JSON contains 3 objects, 3 VMs are allocated.
1099
+
- **Test Case Distribution:** Test cases are then distributed across these VMs. For each VM, test cases are distributed based on the `username` present in the filtered JSON objects. All test cases related to the same `username` are assigned to the VMs containing that `username`.
1100
+
1101
+
So as per the above filtered JSON data:
1102
+
1103
+
- **VM1** will receive all test cases related to `username: "abc"`
1104
+
```javascript
1054
1105
{
1106
+
"accesskey": "jhscuystc7ewgucu79as8yc9",
1055
1107
"username": "abc",
1056
-
"HYPERTEST_INDEX": 0,
1057
-
"HYPERTEST_CONCURRENCY": 1
1058
-
},
1108
+
"tags": "@x"
1109
+
}
1110
+
```
1111
+
1112
+
- **VM2** will receive all test cases related to `username: "bcd"`.
1113
+
```javascript
1059
1114
{
1115
+
"accesskey": "cjdy87328yeiqhd93urd28hh",
1060
1116
"username": "bcd",
1061
-
"HYPERTEST_INDEX": 0,
1062
-
"HYPERTEST_CONCURRENCY": 1
1063
-
},
1064
-
{
1065
-
"username": "def",
1066
-
"HYPERTEST_INDEX": 0,
1067
-
"HYPERTEST_CONCURRENCY": 2
1068
-
},
1069
-
{
1070
-
"username": "def",
1071
-
"HYPERTEST_INDEX": 1,
1072
-
"HYPERTEST_CONCURRENCY": 2
1117
+
"tags": "@y"
1073
1118
}
1074
-
]
1075
-
```
1119
+
```
1076
1120
1077
-
#### Working of `dataJsonBuilder`
1121
+
- **VM3** will handle the JSON object:
1122
+
```javascript
1123
+
{
1124
+
"accesskey": "jhscuystc7ewgucu79as8yc9",
1125
+
"username": "abc",
1126
+
"tags": "@y"
1127
+
}
1128
+
```
1078
1129
1079
-
- **Reading JSON Data:** The JSON data is read from the file specified in the path configuration.
1080
-
- **Applying Filters:**
1081
-
If filters are specified, the JSON objects are filtered according to the rules:
1082
-
- **Attributes:** Filters based on specified key-value pairs are applied first.
1083
-
- **Query:** A logical query filter is applied if the attributes filter is not specified or after the attributes filter is applied.
1084
-
- **Indexing:** The JSON objects are then indexed based on the key specified in the index configuration. This indexing helps in determining the distribution pattern for test execution.
1130
+
Test cases related to `username: "abc"` will be split between **VM1** and **VM3**, while test cases related to `username: "bcd"` will be handled by **VM2**.
1085
1131
1086
1132
#### Use Cases
1087
1133
- **Filtering and Indexing :** When both filtering and indexing are required, filters are applied first, followed by indexing of the filtered results.
0 commit comments