Presumably you have a test for add_five/1
and a test for add_six/1
. In this case, the test for add_six/1
will fail alongside the test for add_five/1
.
Let's assume you decide to check add_six/1
first. You see that it depends on add_five/1
, which is also failing. You can immediately assume that the bug in add_five/1
is cascading up.
Your module dependencies form a directed (hopefully acyclic) graph. If a dependency of you function or module is broken, that should be what you target for debugging first.
Another option is to mock out the add_five
function when testing your add_six
function, but this quickly creates a lot of extra typing and logic duplication. If you change the spec of add_five
, you have to change every place you reimplemented it as a mock.
If you use a quickcheck-style testing library, you can test for certain logic errors based on the properties of what you're testing. These bugs are detected using randomly generated cases that produce incorrect results, but all you as a tester write are library-specific definitions of the properties you're testing for. However, this will also suffer from dependency breakages unless you've mocked out dependent modules/functions.