In unit test design, it is very easy to fall into the trap by actually calling your implementation logic.
For example, when testing an array from int, which should be higher than two (2, 4, 6, 8, etc.), is it really enough to get the return value from the method and claim that this template is the case?
Am I missing something? It seems that one unit test method should be more reliable by testing the same expectation in several ways. So the above expectation can be stated by checking for an increase of two, but also the next number is divisible by 2. Or is it just redundant logic?
So, does unit test need to test for one expectation in several ways? For example, if I wanted to check that my pants fit me, I could / could measure the length, put it next to my leg and see the comparison, etc. Is this the logic that is needed for unit testing?
thank
source
share