POV-Ray : Newsgroups : povray.off-topic : Q about Unit Tests : Q about Unit Tests Server Time
4 Sep 2024 17:22:33 EDT (-0400)
  Q about Unit Tests  
From: Darren New
Date: 2 Dec 2009 17:18:50
Message: <4b16e7ca$1@news.povray.org>
OK, so I have a media player.

After initialization, it should have a mode of "stopped" and a speed of 100% 
and a volume of 100% and an empty error code and an elapsed time of zero.

So I write a unit test to create and initialize a player, then check that 
answer.

Now I want to make sure elapsed time moves forward while playing. So I 
create a player and initialize it, tell it to play, wait 12 seconds, and 
make sure I have about 10 seconds of elapsed time in the elapsed time counter.

The question is this: since all tests are supposed to be independent, should 
I test that after initialization I have a speed of 100%, mode of stopped, 
and all that yadda in the first test? Or can I assume that first test 
worked, and just test that switching to play makes the mode go to "playing" 
and the elapsed time counter increment?

What do people who write lots of unit tests suggest?



-- 
Darren New, San Diego CA, USA (PST)
   Human nature dictates that toothpaste tubes spend
   much longer being almost empty than almost full.


Post a reply to this message

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