--

Sorry, long variable names have their place as long as they’re telling you something meaningful, and when unit testing, ensuring methods are called with the values you expect is important. It helps you ensure what you’re delivering is sound AS you code it, and it helps future developers know if they’ve messed something up when making changes or refactoring.

There are frequently cases where if you don’t call a particular method you may still return the same result. So a test that is looking purely at the result may miss something critical. E.g. someone accidently commented out the code that sends that email, or added a conditional that means that an event never gets created, having subtle side effects that you and your code reviewers don’t notice.

--

--

Andrew Scott Chapman
Andrew Scott Chapman

Written by Andrew Scott Chapman

Senior Software Engineer, terrible but enthusiastic table tennis player.

No responses yet