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
Q: Persist (across > 1 tests) value to variable based on JSON response? #149
Comments
One of the main issues with this general idea (also discussed on #78) is how to come up with a reasonable scenario to reference back multiple steps. Your idea takes a somewhat different spin in that you want to be able to say: assign this result to a variable. I continue to worry that that level of flexibility will lead to unreadable tests and readable tests is one of the main goals of gabbi. However, if you have some ideas on how the syntax might work, please stick them on here so we can hash through it. Enough people have asked for it that it is probably worth considering. For some reason I find your idea a bit more appealing. It feels like the syntax could be less fugly if done right. |
We need this as well, for an S3-like multi-part upload, which requires the results of multiple previous responses. I think a nice interface would be to have something like: This can be implemented by going up the chain of |
I continue to be reluctant about this for the reasons stated in #78. Which is not to say "no, this is never going to happen", just that it's something where we should make sure there are no other options. The interface suggested by @samuelfekete is certainly better than anything we've thought of before (especially as it is safe in the face of the number of tests in a suite changing). @FND and @jasonamyers, you want to weigh in? |
I can think of workarounds, but they are ugly. Like, having an endpoint I can call that acts as a dictionary. |
Happy to contribute a with a pull request if this approach is acceptable. |
I really like the idea of $HISTORY. That could be very useful for some test cases I've been avoiding. I'm not a fan of the multiple |
I'm not sure what you mean on this. The tests are already run in strict first to last order per file/suite. Even if you select just one test, it's priors are run. In a parallel environment some handling is required in the test harness to make sure grouping is done properly (see the warning). |
I agree we are fine with parallelism today. Mostly wondering if we might need something like that in the future to guard against missing history. Either way I really like the idea of the $HISTORY. |
Yeah, I've talked around and it seems worth pursuing. I suspect it could take a few iterations to make everyone happy, but the initial idea of |
#194 got this in a reasonable fashion |
Example algorithm to be expressed in YAML:
Thanks as always!
The text was updated successfully, but these errors were encountered: