tracetest icon indicating copy to clipboard operation
tracetest copied to clipboard

Provide a mechanism to make API calls in sequence

Open mrwatson opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. Our potential use for tracetest requires making a series of API calls in sequence and validating behavior at each step. For example:

  1. Make a call to create a thing in the database. Verify results by making assertions about traces that were received and checking JSON response from the call.
  2. Using data returned from the first call (such as the ID from the JSON response), execute a second API call to query or mutate that data in some way. Verify results again.
  3. Etc.

Describe the solution you'd like Provide a means to organize several test triggers to be run in sequence (or, even better, execute conditionally, but I would consider this a stretch goal and not necessary for my current requirements). Each test should return its results in such a way that they can be used in future tests in the sequence (i.e., use an ID returned from the first call in the second call).

Describe alternatives you've considered Executing a series of tests via bash scripting or equivalent gets part of the way there, but is labor intensive and possibly brittle.

Additional context N/A

mrwatson avatar Jul 20 '22 19:07 mrwatson

I've been thinking about this issue for some time now, and I've come up with a proposal: https://github.com/kubeshop/tracetest/issues/951. This is just my first though, so feel free to comment any thoughts you have, but I think it's simple and useful

schoren avatar Jul 20 '22 21:07 schoren

@mrwatson We implemented these changes in v0.8 and implemented a couple of 'clean up' to the rather sizable commit. It is pretty stable now in the 0.8.2 release - would love for you to try it and give us some feedback! You can read about the release, including a reference to your filing this issue, here: https://tracetest.io/blog/v08-release-notes

kdhamric avatar Dec 15 '22 17:12 kdhamric

@mrwatson you can read about transactions here. We use it in our integration tests as well. You can check this as an example

mathnogueira avatar Jan 25 '23 22:01 mathnogueira

Awesome. We'll revisit this and see how it works for us. Thanks! I appreciate your responsiveness here.

mrwatson avatar Jan 25 '23 22:01 mrwatson