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

Erlang code as a step #59

Open
danron opened this issue Feb 8, 2017 · 2 comments
Open

Erlang code as a step #59

danron opened this issue Feb 8, 2017 · 2 comments

Comments

@danron
Copy link

danron commented Feb 8, 2017

Hi.

I needed "smarter" KATT scenarios so I implemented a new step type that I call action. It allows you to write Erlang code as a step and it looks like this, tell me what you think:

Running this in the erlang shell:
katt:run("priv/test_action.apib", [{inparam, "invalue"}]).

POST /helloworld
> Accept: text/html
Hello {{<inparam}}
< 200
{
"param1":"{{>param1}}",
"param2":"{{>param2}}"
}

! erlang <<<
A = mymodule:dostuff("{{<param1}}"),
B = othermodule:dostuff("{{<param2}}"),
[{outparam1, A},{outparam2, B}].
>>>

POST {{<outparam1}}/{{<outparam2}}
< 200

@andreineculau
Copy link
Member

Have you seen #53 and specifically this PR #57 ?
I believe this issue should be treated as duplicate, if I'm not mistaken.

@danron
Copy link
Author

danron commented Mar 14, 2017

It is very similar but this one is more generic because it is not tied to a request. Code executed outside the context of a request makes it much cleaner IMHO.

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

No branches or pull requests

2 participants