karate
karate copied to clipboard
Feature request: Multiline expressions on call keyword
It would be great if we could have the ability to pass the final parameter of the call
keyword (https://karatelabs.github.io/karate/#call) as a multi-line expression (https://karatelabs.github.io/karate/#multi-line-expressions), so that we don't have to define an additional variable in a previous statement. e.g.
Currently we do:
Feature: Some scenarios
Background:
* def CreateThing = read('classpath:util/api.feature@name=CreateThing')
Scenario: First scenario
* def thingRequest =
"""
{
"prop1": "value1"
}
"""
* def thing = call CreateThing thingRequest
But it would be nice to do:
Feature: Some scenarios
Background:
* def CreateThing = read('classpath:util/api.feature@name=CreateThing')
Scenario: First scenario
* def thing = call CreateThing
"""
{
"prop1": "value1"
}
"""
The purpose is to reduce the noise when calling other functions - which when setting up a scenario which requires complex prerequisites, every little helps!
@richardmward makes sense. call
is bending the rules of JS, but for the sake of things like what you are requesting.
placing this as help wanted
for now, do consider submitting a PR if you can !
I would like to contribute. This is my first time contributing to open source project.
@pradeepprabhakar sure. this will require some independent digging from your side into how the code works
@ptrthomas I understand.