As some posters have already said, it depends what you are trying to test.  

If you want to test what your solution does when it receives a 
randomly-generated number, then you don't need to use random numbers.  You can 
hide the generation of the random number in a type which is defined by an 
interface.  Then you can supply a dummy version of the type which supplies 
numbers that you choose specifically for your test.  So for example, if you 
want to test what your solution does when it receives a randomly-generated 
number less than 10, you set up a test that supplies it with 8.

On the other hand, if you want to test the random number generator, for example 
to test its randomness, then this approach is no good.

Simon

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to