October 2013
Intermediate to advanced
368 pages
9h 20m
English
It’s easy to craft tests that are difficult for others to read. When using test doubles, it’s even easier to craft tests that obscure information critical to their understanding.
ReturnsDescriptionForValidLocation is difficult to understand because it hides relevant information, violating the concept of test abstraction (see Section 7.4, Test Abstraction).
| c5/4/PlaceDescriptionServiceTest.cpp | |
| | TEST_F(APlaceDescriptionService, ReturnsDescriptionForValidLocation) { |
| | HttpStub httpStub; |
| | PlaceDescriptionService service{&httpStub}; |
| | |
| | auto description = service.summaryDescription(ValidLatitude, ValidLongitude); |
| | |
| | ASSERT_THAT(description, Eq("Drury Ln, Fountain, CO, US")); |
| | } |
Why do we ...