Knowledgebase

Writing Tests Print

  • python, database, guide, howto, solution, zillionkinghost, hosting, support
  • 0

Verifying behaviour automatically.

WHAT A TEST IS

Code that checks your code does what it should.

WHY BOTHER

Changes can be made without fear Bugs are caught before deployment The test documents intended behaviour

WHAT TO TEST FIRST

The logic that matters most Anything that has broken before Edge cases and failure paths

WHAT NOT TO TEST

Trivial code Library behaviour Everything, if that prevents you testing anything

WHAT A GOOD TEST IS

Fast Independent of other tests Deterministic Clear about what it checks

WHAT MAKES TESTS PAINFUL

Dependence on external services Dependence on a database Dependence on timing

WHAT TO DO ABOUT THOSE

Separate logic from external access, so logic can be tested alone.

That single structural decision makes testing possible.

WHAT TO RUN THEM WITH

An established test framework.

WHEN TO RUN THEM

Before every deployment, at minimum.

WHAT A FAILING TEST MEANS

Either the code or the test is wrong. Establish which.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot