8000 How to iterate by reusing results of a previous step in current step? · Issue #602 · authorjapps/zerocode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
How to iterate by reusing results of a previous step in current step? #602
Open
@sudhindra95

Description

@sudhindra95

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)

[
  {
    "key": "key1",
    "value": "value1"
  },
  {
    "key": "key2",
    "value": "value2"
  },
  {
    "key": "key3",
    "value": "value3"
  }
]

I have the following Zerocode scenario file:

{
  "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 :

{
  "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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0