The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Test Last Design

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Test Last Design Posted: Jun 15, 2005 4:07 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Test Last Design
Feed Title: David Buck - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/buck-rss.xml
Feed Description: Smalltalk can do that
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From David Buck - Blog

Advertisement

The new beta of VisualStudio 2005 has a built-in testing framework similar to NUnit. It also has a feature that automatically generates test stubs for you based on the code you've written. It creates a test for each method and fills in code to create the necessary objects, call the method, and check the results. In most cases, it doesn't really know what to fill in, so it just puts stub values in for the developer to replace later.

Although this may seem like a very beneficial feature, I fear that it will lead developers back to bad habits. Any time a tool makes it easy to do something the wrong way, people will follow the easy route and do it the wrong way. In this case, the problem is that easiest way to create your testcases is to wait until your class is finished then have the tool generate the tests for you. This is the exact opposite of Test First Design. It's actually Test Last Design. Writing the tests is the very last thing you do.

In fact, if I create tests for a class then add an additional method and try to create a test for the new method, I get a critical error - it doesn't let me do it. This may just be a problem with the beta (I'll be reporting it), but I don't believe it's intended to work this way.

The final problem I have with automatically generating testcases is that the testscases tend to test the wrong things. Developers will start to think that you have one testcase per target method and that will adequately test the method. They won't consider exceptional values, boundary conditions, etc. If you are given the method stubs and told to just modify them to turn them into the proper tests, you aren't in the right mindset for thinking - hey, I need a whole new test to check the boundary conditions.

Generating tests from code leads to poor practices. I suppose it's better than not having tests at all, but it leads developers in the wrong direction. This is a feature I expect to see badly abused in the future.

Read: Test Last Design

Topic: Too many bad ideas to count Previous Topic   Next Topic Topic: Changing the structure

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use