karatelabs / karate

Test Automation Made Simple

Home Page:https://karatelabs.github.io/karate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to call Json Object as a Parameter in Karate feature

shilpabanchhor08 opened this issue · comments

IMPORTANT: If you have a general question please use Stack Overflow instead where Karate has a dedicated "tag": https://stackoverflow.com/questions/tagged/karate

If you are sure you have found a bug, please make sure you follow the instructions here: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue

I am trying to send as a parameter of env to Json object.

For eg:

  • def env = karate.env
  • karate.log("env is :" + env)
  • def app = testData.{#env}.yourApps
  • karate.log("App is :"+ app)

Here testData is calling a Json file.
Now env i need to pass to JSON File

In below example stage1 should send from karate.env

My Json File is:
"stage1": {
"members": {
"member": "SIRT+Automation+stg1@clover.com",
"role": "AutomationRole"
},
"yourApps": {
"appInPendingStatus": "TestAutomationSIRT_India",
"publishedApp": "AppTestLocale",
},