On 5/3/2014 3:32 PM, Walter Bright wrote:
On 4/30/2014 1:36 PM, Andrei Alexandrescu wrote:
One good example is networking tests - if I worked on an airplane I'd
love to
not test tests that need connectivity with a simple regex.
I am suspicious that testing networks with a unit test is an
inappropriate use of unit tests.
Unit tests should be testing individual functions. The "network" for
those tests should be a mockup, not the actual network. A mock network:
1. can model extreme, unusual, perverse, and corner cases of networks,
whereas real networks try to avoid that
2. will generate reproducible results
Testing networks should be more of a system test, not a unit test.
I'm not sure mock networks can really be used for testing a client-only
lib of some specific protocol. There may also be other examples.
There's also the question of whether or not D's "unittest {...}" should
*expect* to be limited to tests that are *technically* "unit tests".
Currently, "unittest {...}" is useful for more forms of testing than
just "unit" tests. I think it's debatable whether we want kill off those
uses without offering a comparable alternative with reasonable migration.