|
 |
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
|
 |