Indirect Testing
Definition:
The Test Method is interacting with the SUT indirectly via another object thereby making the interactions more complex.
Code Example:
private final int LEGAL_CONN_MINS_SAME = 30;
public void testAnalyze_sameAirline_LessThanConnectionLimit()
throws Exception {
// setup
FlightConnection illegalConn = createSameAirlineConn( LEGAL_CONN_MINS_SAME - 1);
// exercise
FlightConnectionAnalyzerImpl sut = new FlightConnectionAnalyzerImpl();
String actualHtml = sut.getFlightConnectionAsHtmlFragment( illegalConn.getInboundFlightNumber(),
illegalConn.getOutboundFlightNumber());
// verification
StringBuffer expected = new StringBuffer();
expected.append("<span class=”boldRedText”>");
expected.append("Connection time between flight ");
expected.append(illegalConn.getInboundFlightNumber());
expected.append(" and flight ");
expected.append(illegalConn.getOutboundFlightNumber());
expected.append(" is ");
expected.append(illegalConn.getActualConnectionTime());
expected.append(" minutes.</span>");
assertEquals("html", expected.toString(), actualHtml);
}
References:
Quality attributes
- Code Example
- Cause and Effect
- Frequency
- Refactoring
An Empirical Study into the Relationship Between Class Features and Test Smells
An exploratory study of the relationship between software test smells and fault-proneness
Enhancing developers’ awareness on test suites’ quality with test smell summaries
How are test smells treated in the wild? A tale of two empirical studies
On the diffusion of test smells in automatically generated test code: an empirical study
On the interplay between software testing and evolution and its effect on program comprehension
Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfalls, and Opportunities
Scented since the beginning: On the diffuseness of test smells in automatically generated test code
TestQ: Exploring Structural and Maintenance Characteristics of Unit Test Suites
The Relation of Test-Related Factors to Software Quality: A Case Study on Apache Systems