← Back to context

Comment by mehagar

14 days ago

Unit testing proves correctness in regard to the test written (not necessarily the correctness of the application itself). They're similar in that they are both typically fast to run, and that they check an aspect of the program for correctness.

They typically can only prove correctness for specific input data, and then there’s often still some runtime or environment-dependent chance involved which may cause some fraction of the invocations to fail. Is it correct or not if a single invocation succeeds? How can you be sure?

  • Unit tests should be independent of the environment they are run in, and pass or fail consistently. Otherwise, it is not a unit test.