Skip to content

docs: explain why interdependent tests are bad - #11767

Open
TrueFurina wants to merge 1 commit into
loopbackio:masterfrom
TrueFurina:docs/avoid-interdependent-tests
Open

docs: explain why interdependent tests are bad#11767
TrueFurina wants to merge 1 commit into
loopbackio:masterfrom
TrueFurina:docs/avoid-interdependent-tests

Conversation

@TrueFurina

Copy link
Copy Markdown

Summary

Per #683: extends the "Data handling" section of Testing-your-application.md to call out the test-order anti-pattern (one test filling the database for later tests).

Changes

  • docs/site/Testing-your-application.md: new "### Avoid interdependent tests" subsection under Data handling, with:
    • the anti-pattern example (create-todo test feeding the delete-todos test)
    • why it is bad: cascade failures with misleading errors when the first test fails; tests can no longer run individually (it.only(), mocha -g)
    • the fix: independent tests with beforeEach() setup and test-data builders

Example source

Adapted from the acceptance tests referenced in the issue (strongloop/loopback4-example-getting-started PR #2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant