enormous, and they have a significant role in entire business. • Quality • Satisfied customers • Bringing Profit • User Experience • Business optimisation
uncertainties regarding what to test. You should always test: - the happy path - the sad path - the what if scenarios (edge cases) BUT still is it enough?
a 70/20/10 split: • 10% end-to-end tests • 20% integration tests • 70% unit tests By Mike Wacker https://testing.googleblog.com/2015/04/just-say-no-to-more-end-to-end-tests.html TDD
on the repetition of very short development cycle. It is based on the test-first concept of Extreme Programming (XP) that encourages simple design with high level of confidence.
(different packages) • Place test classes in the same package as implementation ◦ com.ezhome.skywalker (src/main) ◦ com.ezhome.skywalker (src/test) • Use descriptive names for test methods ◦ whenNonNumberIsUsedThenExceptionIsThrown()
• Only write new code when test is failing • Rerun all tests every time implementation code changes • All tests should pass before new test is written • Refactor only after all tests are passing
test • Write assertions first, act later • Minimize assertions in each test • Do not introduce dependencies between tests • Tests should run fast • Use mocks • Use setup and tear-down methods • Do not use base classes
from acceptance test–driven development (ATDD). TDD is primarily an engineer’s tool to help create a well-written unit of code (function, class, or module) that correctly performs a set of operations. ATDD is a communication tool between the customer, developer, and tester to ensure that the requirements are well-defined. ATDD encompasses acceptance testing, but highlights writing acceptance tests before developers begin coding
and from ATDD. It includes the practice of writing tests first, but focuses on tests which describe behavior, rather than tests which test a unit of implementation. Recommendation is to use TDD for high “code coverage” and fast feedback and BDD as automated acceptance tests.
A challenge to learn (discipline, practice, persistence) • Hard to apply to existing legacy code • The test suite itself has to be maintained; tests may not be completely deterministic • Lot’s of misconceptions that keep programmers from learning it.