Integration Watch: Driving development with functional tests



Email    print   
January 1, 2010 —  (Page 1 of 3)
As I have pointed out in my recent columns, the world of agile has suddenly become very focused on test-driven development. Within that community, the tug of war between traditional code-then-test and TDD seems to have been won by the TDD practitioners, at least in terms of mind share.

I continue to be surprised how often I hear people who claim to use TDD and then specify that they mean “test first.” It’s hard to fathom how someone could be doing anything close to TDD if they were not doing test-first, so the additional specification suggests that there are divergent views within TDD regarding exactly what practices the initials stand for.

A recent comment on my blog inveighed on this very point, trying to get users to refer strictly to the core TDD practices when using the term: Write a failing unit test, write the smallest amount of code that will enable the test to pass, refactor. Using other imagery, it could be stated as: Lather, rinse, repeat. The problem with insisting on this narrow restriction is that even dyed-in-the-wool TDD experts don’t adhere without variance to this series of steps.
 
For developers hoping to adopt TDD, there are surprisingly few good books on the topic. Kent Beck’s seminal work, “Test-Driven Development: By Example,” anchored the idea in the agile consciousness. And David Astels' “Test-Driven Development: A Practical Guide,” built elegantly on that foundation.

A recent title now joins these standout works. It’s the descriptively named “Growing Object-Oriented Software, Guided by Tests,” by Steve Freeman and Nat Pryce. It would be my starting point today if I were undertaking TDD. It not only explains the whole testing orientation, but it also shows how to choose tests wisely and use them to move forward according to plan, rather than organically.

It also has a strong emphasis on the refactoring aspects, with an eye to the kinds of refactoring typical of the TDD approach (a woefully under-discussed topic). Note that for teaching TDD to students new to programming, I would use Jeff Langr’s “Agile Java.”



Related Search Term(s): agile, testing

Pages 1 2 3 


Share this link: http://sdt.bz/34030
 
Most Read Latest News Blog Resources


Comments


12/31/2009 05:34:24 AM EST

Thanks for the mention of our book. We too use functional tests to guide our development progress, but (obviously) we don't think that's enough. I've spent too much of my life trying to understand what failure a functional test has revealed because it's too high-level. I think it's perfectly fine for developers to spend time on their infrastructure--we're stakeholders too. Unit-TDD is not a luxury for me but a development tool that helps me stay focussed and keeps the code moving. It's true that certain kinds of refactoring are easier when there are fewer unit-level tests, but then I find that those codebases /need/ more refactoring. Obviously, Cedric, you and others have a different experience. There's an interesting counter-movement from people such as Arlo Belshee and JB Rainsberger, who are moving away from automated functional testing to just unit testing but Arlo, at least, has a sophisticated team that knows how to make that work.

United KingdomSteve Freeman


12/31/2009 05:41:47 AM EST

I would love to know what you think about "The art of unit testing" then. It's the only one out there *not* about tdd, but strictly about unit testing. it's .NET oriented, but I found it usable for Java as well.

United StatesJames Mccallen


01/01/2010 10:29:37 AM EST

I certainly agree: It seems redundant, to me, to qualify “Test-Driven Development” by saying that we write the tests first. How else could it be test *driven*? And, like you, I find it invaluable to focus on integration tests over unit tests. Unit tests are easier to write, but often fail to ensure that the system, as a whole, performs as expected. I think this has been known since the start of the practice, considering this quote from its creators: “End to end is further than you think.” – Kent Beck (Quoted in "Extreme Programming Adventures in C#" book, chapter 13, page 182 by Ron Jeffries) I think we should ask ourselves: Why would the founders of TDD say “End to end is further than you think.” if they were doing only unit testing? I illustrate the need for integration testing in my Java News Brief article “An Example of Test Driven Development with the Spring Framework.” The NullPointerException that occurs in the interaction between two units that have independently been unit tested is inspired by a problem that I encountered in production code written with TDD. Yes, the code coverage was good, but the integration between the units was not adequately tested. http://jnb.ociweb.com/jnb/jnbDec2009.html I practice and teach the value of automated integration testing. I believe that this has always been the real intent of the TDD practice.

United StatesJeff Grigg


01/01/2010 10:31:01 AM EST

P.S. I have also found that integration tests enable refactoring more than unit tests.

United StatesJeff Grigg


01/02/2010 05:29:35 PM EST

This is a very well written article. It appears that Andrew is primarily focused on Java testing but for those interested in PL/SQL unit testing, Quest Code Tester for Oracle is an automated PL/SQL code testing tool. Created by one of the world’s most prominent Oracle PL/SQL experts, Steven Feuerstein, Code Tester for Oracle delivers practical and thorough code testing. I hope this information is helpful to PL/SQL developers interested in functinal testing and TDD.

United StatesJoe


01/12/2010 06:46:37 PM EST

Andrew, thanks for this post and the reflections it has triggered. I think another key thing Cedric has said concerns test overlap. I have tried to explore, quantify and understand testing overlap and how they relate to the unit versus functional tests discussion in this post: http://blog.dossot.net/2009/12/is-test-overlap-necessary-evil.html

CanadaDavid Dossot


03/02/2010 10:42:58 PM EST

For years, I have used a mixture of both approaches to TDD: 1)start with a high-level test, 2) start with a low-level test. I choose my approach for a given story based on the highest risk. If I know my technology, then usually the risk of misunderstanding the requirements is highest, and thus I start with a high-level test. If the highest risk is not knowing my technology, I may start with a low-level test. If I REALLY don't know my technology, I may simply open up a separate project and play with it in a directed way to learn enough to plan intelligently. Some people call these a Spike story. If a developer is comfortable using both approaches, they can use their judgement to choose a level of testing that is the best approach for the situation. David Kreth Allen http://codecontracts.info

United StatesDavid Allen


Add comment


Name*
Email*  
Country     


  • Comment
Loading




close
NEXT ARTICLE
Finding the right tool for the agile job
Experts emphasize that tools should bolster the agile process above all else Read More...
 
 
 
 
News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 

Download Current Issue
FEBRUARY 2012 PDF ISSUE

Need Back Issues?
DOWNLOAD HERE

Want to subscribe?


 
blogs tab
Agility, mom, and apple pie
If we're to evaluate the state-of-the-art in software development, we should start with the values espoused in the Agile Manifesto.
02/07/2012 11:57 AM EST

RIM woos developers with free tablet
How do you get more apps ported to the BlackBerry PlayBook? By giving every developer a free tablet, of course!
02/04/2012 01:57 PM EST

GitHire: Use Headhunters to Find Your Perfect Programmer
Are you a hiring manager tired of scouring the job boards? Check out this new service that will find 5 people interested in your jobs.
02/03/2012 12:17 PM EST

Facebook claims hacker cred
Facebook's SEC S-1 filing form includes a short essay on the Hacker Way by Mark Zuckerberg himself.
02/02/2012 08:26 AM EST

Ryan Dahl steps down
Ryan Dahl, creator of Node.js, steps back from his position as gatekeeper for the project.
02/01/2012 04:58 PM EST

Bloomberg opens its API
Bloomberg's APIs could lead to a future standard for accessing market data.
02/01/2012 04:41 PM EST

 
Events calendar tab
2/13/2012 to 2/16/2012
Santa Clara
TechWeb

2/26/2012 to 2/29/2012
San Francisco
BZ Media

2/27/2012 to 3/2/2012
San Francisco
RSA

3/4/2012 to 3/7/2012
Las Vegas
IBM Tivoli

3/5/2012 to 3/9/2012
San Francisco
TechWeb