On 30/04/2014 20:23, Dicebot wrote:
On Wednesday, 30 April 2014 at 18:19:34 UTC, Jonathan M Davis via
Digitalmars-d wrote:
On Wed, 30 Apr 2014 17:58:34 +0000
Atila Neves via Digitalmars-d <[email protected]> wrote:
Unit tests though, by definition (and I'm aware there are more than
one) have to be independent. Have to not touch the filesystem, or the
network. Only CPU and RAM.
I disagree with this. A unit test is a test that tests a single piece
of functionality - generally a function - and there are functions which
have to access the file system or network.
They _use_ access to file system or network, but it is _not_ their
functionality. Unit testing is all about verifying small perfectly
separated pieces of functionality which don't depend on correctness /
stability of any other functions / programs. Doing I/O goes against it
pretty much by definition and is unfortunately one of most common
testing antipatterns.
It is common, but it is not necessarily an anti-pattern. Rather it
likely is just an Integration test instead of a Unit test. See:
http://forum.dlang.org/post/[email protected]
--
Bruno Medeiros
https://twitter.com/brunodomedeiros