Redundant Print
Definition:
Print statements in unit tests are redundant as unit tests are executed as part of an automated. Furthermore, they can consume computing resources or increase execution time if the developer calls an intensive/long-running method from within the print method (i.e., as a parameter).
Code Example:
@Test
public void testTransform10mNEUAndBack() {
Leg northEastAndUp10M = new Leg(10, 45, 45);
Coord3D result = transformer.transform(Coord3D.ORIGIN, northEastAndUp10M);
System.out.println("result = " + result);
Leg reverse = new Leg(10, 225, -45);
result = transformer.transform(result, reverse);
assertEquals(Coord3D.ORIGIN, result);
}
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
Handling Test Smells in Python: Results from a Mixed-Method Study
How are test smells treated in the wild? A tale of two empirical studies
On the Distribution of “Simple Stupid Bugs” in Unit Test Files: An Exploratory Study
On the distribution of test smells in open source Android applications: an exploratory study