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

execute Goatfiles #32

Closed
zekroTJA opened this issue Jul 10, 2023 · 0 comments · Fixed by #33
Closed

execute Goatfiles #32

zekroTJA opened this issue Jul 10, 2023 · 0 comments · Fixed by #33
Assignees
Labels
enhancement New feature or request proposal

Comments

@zekroTJA
Copy link
Member

zekroTJA commented Jul 10, 2023

Besides the use of Goatfiles, which effectively merges the referenced Goatfile definitions with the current Goatfiles definitions, execute could be use to independently run a Goatfile like a function, passing in a list of parameters and receiving back a list of return values.

Syntax Proposal

One proposed syntax could look as following.

Syntax Definition

ExecuteExpression :
execute StringLiteral ExecuteSignature?

ExecuteSignature :
( ParameterAssignment* ) ReturnsValueSignature?

ParameterAssignment :
LF* Literal = Value LF*

ReturnsValueSignature :
return ( ReturnValueAssignment* )

ReturnValueAssignment :
LF* Literal as Literal LF*

Example

execute ../doStuff (
    username="{{.username}}" 
    password="{{.password}}"
    n=1
) return (
    response as response1
)

Implementation

A called Goatfile is executed like a completely separate Goatfile in a batch. It uses it's own state complemented by the parameters passed in. Therefore, a called Goatfile can also have it's own setup and teardown procedures which will behave like in a plain Goatfile execution. Variables specified in the return block are then passed from the resulting state to the state of the currently executed Goatfile.

Each call block would be handled as an Action. So execution order is reserved.

@zekroTJA zekroTJA added enhancement New feature or request proposal labels Jul 10, 2023
@zekroTJA zekroTJA self-assigned this Jul 10, 2023
@zekroTJA zekroTJA changed the title call Goatfiles execute Goatfiles Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant