Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Multiline expressions on call keyword #2189

Open
richardmward opened this issue Nov 22, 2022 · 4 comments
Open

Feature request: Multiline expressions on call keyword #2189

richardmward opened this issue Nov 22, 2022 · 4 comments

Comments

@richardmward
Copy link

richardmward commented Nov 22, 2022

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!

@ptrthomas
Copy link
Member

@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 !

@pradeepprabhakar
Copy link

I would like to contribute. This is my first time contributing to open source project.

@ptrthomas
Copy link
Member

@pradeepprabhakar sure. this will require some independent digging from your side into how the code works

@pradeepprabhakar
Copy link

@ptrthomas I understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants