Great Habits
In this lesson, we introduced a new habit. Check it out in the following list.
Considerations When Writing a New Test
- Tests should test one thing only.
- Create more specific tests to drive a more generic solution (triangulate).
- Give your tests meaningful names (behavior/goal-oriented) that reflect your business domain.
- See the test fail for the right reason.
- Ensure you have meaningful feedback from failing tests.
- Keep your tests and production code separate.
- Organize your unit tests to reflect your production code (similar project structure).
- Organize your test in arrange, act, and assert blocks.
- Write the assertion first, and work backward.
- Write fast, isolated, repeatable, and self-validating tests.
- Consider using object calisthenics to drive design decisions.
- Consider adding tests to legacy code.
- Consider using classic TDD or Outside-In TDD (New habit).
If using Outside-In TDD, start with an acceptance...