March 2015
Intermediate to advanced
236 pages
5h 26m
English
The biggest question each of your tests must clearly answer is, why does it expect the result it does? Readers must be able to correlate between the arrange and assert portions of the test. If the reason for getting the result that the assert expects isn’t clear, your readers waste time digging through the code to find an answer.
The returnsMatchesShowingContextWhenSearchStringInContent test expects a single match on a search for practical joke against a very long string. A reader can eventually spot the place in the string where the phrase practical joke appears and can then do the math to figure out that ten characters before it and ten characters after it represent the string:
| | "or a vast practical joke, though ... |
Read now
Unlock full access