Skip to content

[Tests] Test Health: unit tests should largely verify behavior of the app is as expected, without requiring live sites #2183

Description

@metaprime

Almost all of our tests rely on sites continuing to exist and remain mostly unchanged (stay compatible) with current implementations. Unit tests should instead be in a few tiers:

  1. Basic functionality tests that verify invariants of the codebase, which should not rely on live site input data.
  2. Unit tests of ripper functionality against a known version of the page. This might or might not require launching a web server with static pages encoded in it, sufficient for the test. At minimum it requires HTML of entire pages to be encoded in the test suite either as files or static strings.
  3. Tests that the current versions of sites meet the schema that we expect to parse. No downloads, just request a page and check that it has a valid structure we're testing against.
  4. What we have today: fetch pages from real sites and test downloading the contents, which causes us to get rate limited and makes most tests flaky when ran frequently by CI and users developing the app. Especially if we actually do the downloads. It should be enough to check that a resource exists without actually downloading it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions