authorjapps / authorjapps/zerocode
How to iterate by reusing results of a previous step in current step?
- Dominant language
- Java
- Stars
- 1k
- Forks
- 453
- Avg merge
- 7d 2h
- Merged PRs (30d)
- 5
Description
Hi community, I have the following JSON input file:
`dummy_input.json` (Note: I want to include N key-values in this file, where N~ 1000)
```javascript
[
{
"key": "key1",
"value": "value1"
},
{
"key": "key2",
"value": "value2"
},
{
"key": "key3",
"value": "value3"
}
]
```
I have the following Zerocode scenario file:
```javascript
{
"scenarioName": "Zerocode Loop Example",
"steps": [
{
"name": "send_request",
"url": "kafka-topic:my_topic",
"operation": "produce",
"request": {
"recordType": "JSON",
"records": "${0}"
},
"verify": {
"status": "Ok",
"recordMetadata": "$NOT.NULL"
}
},
{
"name": "query_table",
"url": "com.demo.cassandra.CassandraConnector",
"method": "getResult",
"request": {
"class": "com.demo.core.pojo.MyTable",
"query": "select * from mytable where value='${$.send_request.request.records[0-n].value}'" //how do I iterate over records from 0-n as a loop by passing one value at a time?
},
"assertions": {
"resultData": "$NOT.NULL"
}
}
],
"parameterized": {
"csvSource":[
"${JSON.FILE:tests/input-files/dummy_input.json}"
]
}
}
```
The result produced by the step send_request is :
```javascript
{
"recordType" : "JSON",
"records" : [ {
"key" : "key1",
"value" : "value1"
}, {
"key" : "key2",
"value" : "value2"
}, {
"key" : "key3",
"value" : "value3"
} ]
}
```
I want to pass each value in this result (value1, value2, value3) one at a time to the query that I am using in query_table step. How to achieve this?
I kindly request the author and Zerocode community to assist me in this as this feature is very much needed to test a big data sample
Contributor guide
Assessment
This issue has not been assessed yet.