POV-Ray : Newsgroups : povray.off-topic : Unit Testing question : Re: Unit Testing question Server Time
29 Jul 2024 18:29:21 EDT (-0400)
  Re: Unit Testing question  
From: Darren New
Date: 10 Jun 2011 10:45:49
Message: <4df22e1d$1@news.povray.org>
On 6/10/2011 1:18, Le_Forgeron wrote:
> For instance, in Java, you can redefine the value of 3 and 6.

Of all the languages out there, I'm pretty sure Java isn't one of those. :-) 
  How do you redefine 3 to be 14?

> Would have the unit tests checked for some other intrinsics properties
> of the module, it might have failed.

Yeah. I much prefer pre- and post-conditions to be documented, etc. At least 
you can test them.

And you still wind up only testing what you think to test. Clearly, if MS 
had thought to test "what happens if we try to run two consecutive games in 
the same process", they would have noticed half a dozen things fail to work 
right the second time around. But hey, all the unit tests passed. :-)

> And to make matter worst: module often ends up at the top of a huge
> pyramid of other modules (at best, when there is at least an ordering),
> so emulating the other lower modules is only practical for the very few
> lower modules at the base.

Well, the mock frameworks seem to do an OK job, as long as you're willing to 
just specify what calls you expect the unit test to make. If you try to unit 
test something actually complex, it winds up just being equivalent to "run 
the program and compare the output with the previous run."

Unit tests really only work well to test your invariants, your pre- and 
post-conditions, on units that are fairly stand-alone. And it only works if 
you have an objective answer as to what the right result should be. You 
can't unit test for "this indeed looks like water coming out of a fountain."

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.