Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Bad Practices of Testing

Presentation showing bad test code and how to improve it.

All examples come from real commercial projects and caused development team smaller or bigger problems.

No code has been taken from these projects. All code shown has been written from scratch using completely different (made-up) domain in order to show only the smallest necessary snippet of code.

Click to start reading, or if you prefer to try yourself, this repository contains all the code without solutions.

Table of contents

  1. Meaningless tests names
  2. Using JUnit Parameterized
  3. Logic in the test
  4. Test's expectations set up in production code
  5. Dependencies between tests
  6. Non thread-safe unit tests
  7. Multiple assert statements to verify a list
  8. Fake not meeting the contract of the interface it is implementing
  9. Testing implementation instead of behaviour
  10. Asserting on exception's message
  11. Swallowing assertion error
  12. Mocking data objects
  13. Testing what the code does not do
  14. Asserting on default value
  15. Non distinct test data
  16. JMock verifying method was called
  17. Fluent assertions (AssertJ)


Presentation showing bad test code and how to improve it



No releases published


No packages published