1
    * def runOperation1 = read('classpath:ic/common/resources/operation/runOperation.feature')
* def operationInputData = read('classpath:ic/feature/streaming/TestData/operationData.json')
* def result = call runOperation1 operationInputData
 * def AllResponse = $result[*].response
 * print AllResponse

Here 'AllResponse' are populated after completion of all executions from json array. For each json array we need to call some other feature and assert some value. Then we need to traverse for another element in json array

1
  • edited my post.. Commented Mar 12, 2019 at 15:23

1 Answer 1

2

I see 2 ways for this,

1, Add that additional step of calling another feature and assertion also into your runOperation.feature

2, Instead of call Create a dynamic scenario outline for a scenario in runOperation.feature and add your call step inside that scenario

EDIT :

Assume operationData.json as,

[
 {"name": "Johan"}, 
 {"name": "Ben"}
]

Assume runOperation.feature as

Feature: run operation feature
 Scenario: run operation Scenario
     Given url "http://httpbin.org/get"
     And path name
     And method get
     And status 200

Assume anothercall.feature as

Feature: another call feature
 Scenario: another call scenario
     Given url "http://httpbin.org/get"
     And path name
     And method delete
     And status 200

Now your current feature can be,

Background:
  * def operationInputData = read('classpath:ic/feature/streaming/TestData/operationData.json')

Scenario Outline:
  # steps from runoperation.feature
  Given url "http://httpbin.org/get"
  And path <name>
  And method get
  And status 200
  # calling another feature
  Then def anotherCall = call read("anothercall.feature") {"name": <name>}
  # match / assert condition
 Examples:
 |operationInputData|

I suggest going with the second option as the first one can lead to unnecessary complication.

Sign up to request clarification or add additional context in comments.

5 Comments

Hi Babu, <steps in run feature expects the json array values. But json array values are not passed to the request using scenario outline.
Any help will be appriciated. As we need this for testing 5000 requests per day for external application. When I print the 'opeationInputData ' it is properly printing the json array.
Which version of karate are you using ?
my bad.. then you cant use dynamic scneario outline.. Can you upgade to 0.9.1 ??
Hi Babu, your suggested solution is working perfectly fine in 0.9.1. Thank you for super simpler response. Karate is just amazing :) Hats off to Intuit and its developers :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.