Skip to content
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

[BUG] Examples for path parameters don't generate test cases #1729

Closed
2 tasks done
moalje opened this issue Apr 7, 2023 · 0 comments · Fixed by #1952
Closed
2 tasks done

[BUG] Examples for path parameters don't generate test cases #1729

moalje opened this issue Apr 7, 2023 · 0 comments · Fixed by #1952
Labels
Core: Data Generation Generating test data Difficulty: Intermediate Requires some experience Priority: Medium Planned for regular releases Specification: OpenAPI Specific to OpenAPI Type: Feature New functionalities or enhancements
Milestone

Comments

@moalje
Copy link

moalje commented Apr 7, 2023

Checklist

Describe the bug

There are no test cases generated from "examples" for path parameters in Phase explicit (run with pytest). The values from enum are used only for test cases generated for the requestBody "example"/"examples" (if present). The "example" works fine, but you can have only one test case from that.

To Reproduce

OpenAPI yaml example:

openapi: "3.1.0"
info:
  version: "0.1"
  title: Example

servers:
  - url: "www.example_url.com"

security: []

paths:
  /api/{dir}/{filename}:
    parameters:
      - name: dir
        in: path
        required: true
        schema:
          type: string
          enum:
            - favorite
            - best
            - new
        examples:
          favorite:
            value: favorite
          best:
            value: best
          new:
            value: new
      - name: filename
        in: path
        required: true
        schema:
          type: strin
        example: test.mp4
        examples:
          some_file:
            value: some_file.txt
          other_file:
            value: other_file.txt
          extra_file:
            value: extra_file.txt
    get:
      responses:
        "200":
          description: "OK"

For the example above, there is only 1 test case generated for the Phase explicit: Case(path_parameters={'filename': 'test.mp4', 'dir': 'new'}) and it is the one from "example" keyword. All "examples" are ignored.

Expected behavior

I expect the test cases to be generated from "examples" too.

Environment (please complete the following information):

  • OS: Linux
  • Python version: 3.10
  • Schemathesis version: 3.18.5
  • Spec version: Open API 3.1.0
@moalje moalje changed the title Examples for path parameters don't generate test cases [BUG] Examples for path parameters don't generate test cases Apr 7, 2023
@Stranger6667 Stranger6667 added this to the 3.21 milestone Oct 16, 2023
@Stranger6667 Stranger6667 added Priority: Medium Planned for regular releases Type: Feature New functionalities or enhancements Specification: OpenAPI Specific to OpenAPI Difficulty: Intermediate Requires some experience Core: Data Generation Generating test data labels Oct 16, 2023
@Stranger6667 Stranger6667 modified the milestones: 3.21, 3.22 Oct 17, 2023
@Stranger6667 Stranger6667 modified the milestones: 3.24, 3.23 Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core: Data Generation Generating test data Difficulty: Intermediate Requires some experience Priority: Medium Planned for regular releases Specification: OpenAPI Specific to OpenAPI Type: Feature New functionalities or enhancements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants