For the complete documentation index, see llms.txt. This page is also available as Markdown.

Fixtures

What are fixtures?

Think API intercept and modify behavior in testing libraries

Stoobly fixtures are predefined responses used during mocking. Fixtures are used in the case where a recorded response is not found for the current request.

Why use fixtures?

  • Quick way to mock a request in the case where a specific response is difficult to record

  • Serve assets that otherwise should not be recorded

Example Fixtures YAML File

The following is an example file for a fixtures-response.yml passed to the --fixtures-response-path option:

DELETE:
    /users/d+?:
        headers: {}
        path: ./relative-path-to-response
        status_code: 200
GET:
    /users/d+?:
        headers: {}
        path: ./relative-path-to-response
        status_code: 200
POST:
    /users:
        headers: {}
        path: ./relative-path-to-response
        status_code: 200
PUT:
    /users/d+?:
        headers: {}
        path: ./relative-path-to-response
        status_code: 200  

Next Steps

How to Use Fixtures

Last updated

Was this helpful?