Redundant Assertion
Definition:
This smell occurs when test methods contain assertion statements that are either always true or always false. A test is intended to return a binary outcome of whether the intended result is correct or not, and should not return the same output regardless of the input.
Code Example:
@Test
public void testTrue() {
assertEquals(true, true);
}
References:
Quality attributes
- Code Example
- Cause and Effect
- Frequency
- Refactoring
An Exploratory Study on the Refactoring of Unit Test Files in Android Applications
Automatic Identification of High-Impact Bug Report by Product and Test Code Quality
Developers perception on the severity of test smells: an empirical study
Handling Test Smells in Python: Results from a Mixed-Method Study
On the Distribution of “Simple Stupid Bugs” in Unit Test Files: An Exploratory Study
On the diffusion of test smells and their relationship with test code quality of Java projects
On the distribution of test smells in open source Android applications: an exploratory study
On the test smells detection: an empirical study on the jnose test accuracy
The secret life of test smells-an empirical study on test smell evolution and maintenance