Avoid testing implementation details, test behaviors(codebetter.com)

submitted by dpetersondpeterson(4397) 7 months, 15 days ago

Ian Cooper writes an excellent piece on avoiding test implementation details, concentrating on the Red, Green, Refactor cycle, and what actually requires testing. He goes on to explain how new classes are not triggers for new tests, but rather new requirements. Overall a well written article that distills some of the values Kent Beck's book: Test Driven Development. If you find yourself struggling with TDD, I'm sure this will clear things right up.

2 comments |category: |Views: 61

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by vijaystvijayst(1311) 7 months, 14 days ago 0

The trigger for writing a test is a new requirement, and not a new class added (during refactoring). The above statement from the post is debatable. In TDD, we are writing unit tests. If the refactored class is used multiple times, it makes sense to invest time in testing it well and making sure that it works well in all conditions.

Reply

posted by dpetersondpeterson(4397) replied to vijaystvijayst(1311), 7 months, 14 days ago 0

That's probably true, but I think the author was trying to convey that in most cases we should try to be in the mindset that we are testing features, rather than just testing code for the sake of testing code. I fully agree with what you say, I just don't think the author was being quite so literal. For someone new to TDD, testing features is a good way to achieve good code-coverage without falling into the traps the author discusses.

Reply

information Login or create an account to comment on this story