Working with test smells
Code smell is a technical debt or symptom that indicates a deeper problem. Smells are not bugs, or they don't fail tests. Instead, they indicate a problem in design or code such that a rigid code cannot be enhanced or can create a maintenance issue. This section covers the test smells that should be refactored for maintenance and readability. The following topics are covered:
- Test code duplication
- Conditions in test code
- Test logic in the production code
- Over engineering
Refactoring duplicates
Code duplication is the simplest code smell. It creates maintainability problems. The same code is written in many places; if any bug is found, then you need to modify all other places. This subsection elaborates on the duplicate code ...
Get Mastering Unit Testing Using Mockito and JUnit now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.