All,
I have seen some use of random number/name generation used in tests
recently and want to discuss it further here. I am
going to go out on a limb and give the opinion that this is not a good
thing, and sets a
bad precedent. I think that the real value of tests is that they are an
easily repeatable, consistent assessment of where
the code is at a certain point in time. Tests really start to lose their
value when two runs of the same test on the same
code base can result in two different outcomes. I know that for things
like name generation this probably won't happen,
but as I said it is starting down a slippery slope, and IMHO we should
avoid it if possible.
Note that there is nothing wrong with *arbitrary* values, or values
determined at random and hard coded into tests - let's
just be sure that they are the same on subsequent runs of the same test.
Thoughts?
- Justin