Integration Watch: Implementing functional TDD
January 15, 2010 —
(Page 1 of 2)
In my previous column, I discussed functional TDD, which is a form of TDD I am cottoning to. The basic difference when compared with unit test-based TDD is that the functional test serves as the driver of code. I write a failing functional test that defines my next coding effort. When the test passes, I either write another, or, more often, I’ll write unit tests to exercise edge conditions on the code I’ve just created. This approach confers many of the same benefits as traditional TDD, while mitigating some of its shortcomings. I discussed some of these in the previous column and promised I’d discuss the tools I use here.
I write functional tests in the two fundamental coding scenarios: prior to writing new code, and when maintaining existing code. Because I code primarily in Java, I’ll look at the tools that work with it.
When fixing defective code, I reproduce the problem using Groovy as a scripting language. Groovy scripts are easy to hack together quickly, and the syntax is close enough to Java that its use is not an obstacle to other developers on the team. They can understand the tests easily. I try to reproduce the defect at the highest level possible. An ideal result is running the entire application and causing the error to show. Then, I’m really testing how the solution I propose works with the various computational units it deals with in deployment, rather than testing it in isolation.
These functional tests go into a regression suite, and the entire suite is run before the defect is closed to make sure all is copasetic. Once the functional test passes, I look for edge conditions and code that was insufficiently tested. And for items, I write either additional functional tests or, more commonly, unit tests. The choice depends on the locus and scope of the tests.
When it comes to writing new code, I rely on tools normally associated with behavior-driven development (BDD). This approach favors writing code scenarios from requirements in the form of tests, and then implementing the scenarios in code. Typically, the scenarios have the form of: given X and Y, when A occurs, B should result. The framework then sets up X and Y, does A, and tests for B.
Related Search Term(s): testing
Share this link: http://sdt.bz/34060
Most Read Latest News Blog Resources
Zeichick’s Take: Radio moves from analog waveforms to digital packets
Streaming radio highlights the need for streaming applications to be designed to take up as little bandwidth as possible
|
|
Taking enterprise architecture to the business side
Startup Corso is bringing out a cloud-based planning platform that ties into business plans
|
|
Appcelerator Acquires Cocoafish to Add Instant Mobile Cloud Capabilities to its Industry Leading Titanium Platform
Appcelerator Offers Messaging, Social, Location and Storage Mobile Cloud Services to All Mobile App Publishers
|
|
ComponentOne Releases a Collection of 40+ UI Widgets Powered by HTML5 and jQuery
ComponentOne has announced the 2012 release of Wijmo: a kit of UI widgets for HTML5 and jQuery development
|
Taking enterprise architecture to the business side
Startup Corso is bringing out a cloud-based planning platform that ties into business plans
|
|
Top five apps to manage your workload
Web applications offer new ways to track your “to-do” lists
|
|
Not so fast when it comes to testing in the cloud
Developers face outsourcing, virtual lab management and mobile devices as obstacles
|
|
Xceed releases UX-focused suite for Microsoft’s WPF
"Blendables" helps match user experiences to developer visions
|
Are you at risk for burnout?
Burnout is a severe problem and it can strike at any time. Here's how to tell if you are nearing the edge.
|
|
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.
|
|
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!
|
|
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.
|
The Hidden Costs of Software Licensing
Moving beyond paper-based software licensing to more flexible, software-based licensing is a business decision. There is a growing trend tow...
|
|
Case Study: You May Need a Development Mechanic
As a contractor for a major financial player in Germany, SOBEGE, a German-based consultancy specializing in embedded IT and web services, wa...
|
|
Ensuring Software Quality at a Major International Bank
One of the world’s leading international banks has adopted AgitarOne technology for delivering generated unit tests for their Java software...
|
|
Load Testing Adobe Flex Applications
Adobe Flex applications may be different from applications you’ve worked with before. For classic HTML web applications, the server does all...
|