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.
TDD
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: TDD
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.
(#10850)