zerocode icon indicating copy to clipboard operation
zerocode copied to clipboard

Variable section for Zerocode DSL

Open siddhagalaxy opened this issue 5 years ago • 1 comments
trafficstars

As an automation test engineer I want a port number or a random number or a random string or all of them to be available to my steps inside a single scenario So that I will be able to reuse this in my steps easily.

Is this already available... by chance?

An example would look like below:

{
  "name":"vars",
  "port":8090,
  "employeeName":"Joe Tidd",
}

In the next step or in any subsequent steps:
{
  "url": "http://hbc.api.github.com:${vars.port}/api/v1/employees",
  "method": "POST",
  "request": { 
        "body":{
            "name": "${vars.employeeName}"
        }
  },
  "verify":{
        "status": 201
   }
}

In next step e.g.:
{
  "url": "http://hbc.api.github.com:${vars.port}/api/v1/employees/${vars.employeeName}",
  "method": "GET",
  "request": { 
  },
  "verify":{
        "status": 200,
        "body":{
            "name": "${vars.employeeName}"
        }
   }
}

siddhagalaxy avatar Nov 07 '20 14:11 siddhagalaxy

@siddhagalaxy , the parameterized should help you to achieve this. However they are not named as you have requested. We will try to implement the above (might be with some refinements/suggestions from the other collaborators).

The below section can be kept outside the steps at the same level as scenario.

{
  "name":"vars",
  "port":8090,
  "employeeName":"Joe Tidd",
}

authorjapps avatar Nov 12 '20 15:11 authorjapps