Skip to content

Faster tests development with gold files #286

@avkonst

Description

@avkonst

There is a cool method to speed up development of tests. It would be great if gabbi supported it too.

Here is the idea:

  1. a test defines that a response should be compared with a gold file (reference to gold file can be custom configurable per every test)

  2. gabbi runs tests with a new flag 'generate-gold-files', which forces gabbi to capture response bodies and headers and (re-)write gold files containing the captured response data

  3. developer reviews the gold files (usually happens one by one as tests are added one by one during development)

  4. gabbi runs tests as usually

    a) if a test has got a reference to a gold file, it captures actual response output and compares with gold file
    b) if content of the actual output matches the gold file content, verification is considered to be passed
    c) otherwise test is failed

This would allow me to reduce size of my test files by half at least.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions