WVAviator/capti

Non-test requests / Repeat option

Opened this issue · 0 comments

The user may want to define a test that involves first making multiple other requests before making an assertion. One example would be to check if the user is properly limited in the number of resources they can create. I think these should be defined inline in a test as some type of "before" option, maybe an array. Additionally, an "repeat" option could be included to indicate how many times the request should be made.

Here is an example of what I'm thinking:

  - test: Max recipes allowed
    description: The user should only be allowed to create 10 recipes, any more should return a 400
    before: # an array of actions to perform before making assertions
      - request:
          method: POST
          body: ${RECIPE_BODY}
        continue_if: # a condition that must be met for the test to continue without failing
          status: 2xx
        repeat: 10 # repeat this item 10 times
    request:
      method: POST
      body: ${RECIPE_BODY}
    expect:
      status: 4xx

In this particular case, each action in the before array is executed sequentially and repeated where indicated. This format is identical to a TestDefinition, the continue_if is just another wording for an expect (and perhaps it should still be called expect) it just doesn't result in a "passed test" if it passes, but if it doesn't, the entire test is marked as failed.

Consideration could be given to defining an "after" array as well, for any cleanup requests (but should those fail the test if they fail?)