Add variables to test triggers
Is your feature request related to a problem? Please describe. Our potential use case involves sending API calls that have varying data in the request body (i.e., randomly generated names or IDs) because the call will fail if run twice with the same variables in the request unless the database is somehow cleaned up in between calls.
Describe the solution you'd like Provide a means to include variables in the request that would be dynamically replaced at run-time. The variables could be specified by the user when the test is triggered or could be generated dynamically by the test itself (such as generating a UUID - Insomnia has a similar feature, for comparison).
Describe alternatives you've considered Dynamically generating the entire test as a YAML file. This would work, but is significantly more effort.
Additional context N/A
That's definitely something that we need. I'm thinking about using some kind of syntax: #{uuid}, #{name}, etc. We can use gofakeit to generate those values for us.
I don't see much value in enabling that kind of data generation in the assertions though. Do you see any value in it or should we only enable that in the triggering transaction request?
Currently, I only see value for data generation on the triggering side. On the assertion side, it would be nice to be able to test against variables, though (see #950).
Yes, currently we only support data generation on the triggering side. I'm planning to start working on adding support to data generation probably on Monday.
About supporting variables, we have the goal of adding support for both variables and expressions: #782
@mathnogueira one concept I believe we will want to add is 'adhoc' running of transactions. Think of it as manual testing - I am developing and need to exercise the api and see oth the response and the trace output. We will want to be able to save these and run them when needed. It will make sense to allow a variable to be passed in or set... so variables may end up helping with that scenario
Hey @mrwatson we just released v0.6.4 and it introduces the concept of generator functions which are functions that generate random data in your test trigger section.
You can read more about it in the generator functions section of in this doc page.
@mrwatson if you feel this doesn't solve your problem. Feel free to open a new issue.
Okay, thanks guys. We'll take a look when we get back around to trying this again.