I'm not thrilled about this idea, but I'm also not dead set against
it. I do worry about flagging up gotest, making it a complex mess,
because it's easier to do that than to write good tests. Gotest's
main virtue, which is a Very Big one, is its utter simplicity. It's a
testing tool; let's no turn it into a testing development environment.
-rob
Russ
> I guess there's a bit of a chicken and egg situation here: you're not
> going to know that you need to write a new, better, deterministic test
> until your randomized test points out that you have a problem.
Ideally the test shouldn't have to *break* for the person writing the
test to understand the difference between a deterministic and a
non-deterministic test. Test frameworks generally try to do the
precise opposite: running tests the same way so that breakages are
more easily reproducible. An interesting case is QuickCheck for
instance, from Haskell, which inherently depends on "random" data to
function, but really uses a fixed seed.
That said, nothing against a flag, of course.
>> because it's easier to do that than to write good tests. Gotest's
>> main virtue, which is a Very Big one, is its utter simplicity. It's a
>> testing tool; let's no turn it into a testing development environment.
I half agree. I see the motivation and benefit on your end, but I
also miss some additional features when writing libraries. That's
where gocheck[1] came from.
> We're doing a bunch of library-type development. This kind of code is
> amenable to unit testing using gotest and since there probably isn't
> global state (except maybe some files written to disk by some tests),
> you really wouldn't expect a randomized test order to break anything.
>
> On top of these libraries we are writing a bunch of components, which
> is where goroutines and channels come into play. To some extent each
> component can still be unit tested, but you also want to write tests
> where a small set of components interact with each other, passing
> messages and whatnot.
It's a bit late here, so maybe it'll come up naturally in the morning,
but I don't really get the motivation for the randomized tests in the
above description.
--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/blog
http://niemeyer.net/twitter