TDD

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
Cirdan
Forum Contributor
Posts: 144
Joined: Sat Nov 01, 2008 3:20 pm

TDD

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: TDD

Post 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.
(#10850)
Cirdan
Forum Contributor
Posts: 144
Joined: Sat Nov 01, 2008 3:20 pm

Re: TDD

Post by Cirdan »

Okay, that makes sense. Thanks for the help.
Post Reply