Timeline for How do you detect dependency problems with unit tests when you use mock objects?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 29, 2018 at 15:57 | comment | added | Frank Hileman | @cmaster You summarized the difference between a test and a proof very well. Thanks! | |
| Mar 29, 2018 at 15:56 | comment | added | Frank Hileman | @RobbieDee Tests (including unit tests) are a poor substitute, often the best available, for the real goal, a machine checked proof. Consider the entire state space of the units under test, including the state space of any components or mocks therein. Unless you have a very restricted state space, tests cannot cover that state space. Complete coverage would be a proof, but this is only available for tiny state spaces, for example, testing a single object containing a single mutable byte or 16 bit integer. Automated proofs are vastly more valuable. | |
| Mar 29, 2018 at 10:08 | comment | added | cmaster - reinstate monica |
@RobbieDee I guess, he meant that when you test for fac(5) == 120, you have not proven that fac() does indeed return the factorial of its argument. You have only proven that fac() returns the factorial of five when you pass in 5. And even that is not certain, as fac() could conceivably return 42 instead on the first mondays after a total eclipse in Timbuktu... The problem here is, that you cannot prove compliance by checking individual test inputs, you would need to check all possible inputs, and also prove that you have not forgotten any (like reading the system clock).
|
|
| Mar 28, 2018 at 17:56 | comment | added | Robbie Dee | Unit tests do not prove the correctness of anything. Not sure I understand this, unit tests check their own results surely? Or did you mean a behaviour cannot be proved correct since this may encompass multiple layers? | |
| Mar 27, 2018 at 18:33 | history | answered | Frank Hileman | CC BY-SA 3.0 |