Page 1 of 1

TDD

Posted: Mon Nov 03, 2008 11:47 pm
by Cirdan
I'm new to TDD and had a question. Say I had a method that sets a variable to true. To perform a test, I would need to write another method to get the value. I do not need this method in my code. Is there another way to go about testing this?

EDIT: Woops, I guess this should go into the testing board.

Re: TDD

Posted: Tue Nov 04, 2008 12:58 am
by Christopher
Don't test what the class is doing internally, only test what it does externally. If you pass a true value to a method, what does that cause to now do? If you pass false, how does it act differently? You test what you ask of a class, not what you tell it.

Re: TDD

Posted: Tue Nov 04, 2008 11:56 am
by Cirdan
Okay, that makes sense. Thanks for the help.