Endava / cats

CATS is a REST API Fuzzer and negative testing tool for OpenAPI endpoints. CATS automatically generates, runs and reports tests with minimum configuration and no coding effort. Tests are self-healing and do not require maintenance.
Apache License 2.0
1.11k stars 75 forks source link

Test inputs based on examples for path/query params #33

Closed tech-bee-10 closed 2 years ago

tech-bee-10 commented 2 years ago

For request body, if we add examples in schema, generated inputs take the example for generating meaningful inputs. Is there similar way to generate inputs for path/query parameters? I tried adding examples for them but CATS doesn’t generate any test cases using examples values.

en-milie commented 2 years ago

i’ll check and get back.

en-milie commented 2 years ago

@rand-guy can you please post an example. If I do this:

/pets/{id}:
    get:
      description: Returns a user based on a single ID, if the user does not have access to the pet
      operationId: find pet by id
      parameters:
        - name: id
          in: path
          description: ID of pet to fetch
          required: true
          schema:
            type: integer
            format: int64
            example: 78
        - name: page
          in: query
          description: Page number
          required: true
          schema:
            type: string
            example: test

It considers the given examples.

tech-bee-10 commented 2 years ago

Yeah, I tried for the above example. It works fine. For me, the openAPI spec created is having this format.

schema:
    type: integer
    format: int64
example: 78

Will check how I can update the spec to be able to get the format you mentioned. Thanks.