InfoQ

Interview

   Good News: We have re-worked our video infrastructure to provide more reliable service. Please email bugs at infoq.com with any problems.

Cédric Beust discusses Designing for Testability

Interview with Cédric Beust by Floyd Marinescu on Apr 28, 2008 10:00 PM

Community
Java
Topics
Software Testing,
Unit Testing
Tags
TDD,
TestNG,
Testing,
Design Patterns
Summary
In this interview from QCon San Francisco 2007, Cédric Beust discusses designing and architecting for testability, problems that hinder testability, test-driven development, the "Next Generation Testing" book, performance testing recipes, and testing small, medium and large codebases.

Bio
Cédric Beust is the co-founder of the TestNG framework and is a senior software engineer at Google. He holds a PhD in computer science. His interests include aspect-oriented programming, testing, tools, back-end and GUI and everything related to software engineering in general. Cedric maintains a weblog at www.beust.com/weblog.
This is Floyd Marinescu at QCon here with Cedric Beust. Cedric, would you tell us a bit about yourself and what you are up to?
How do you design for testability?
What does an architecture design for testability look like?
You mentioned replacing static member variables?
So you mentioned replacing static members and methods with dependency injection. Tell us a bit more about that.
In the spectrum of TDD zealousness we have people like Bob Martin who say "you're not a good developer if you're not doing TDD" and we have Jim Coplien saying "if you're doing TDD something's wrong with you". Where do you fit on that spectrum?
Why are you skeptical of TDD? Give us some reasons.
In your opinion what is the best level to apply your testing, like how much testing?
You wrote a book called: "Next Generation Testing" and I assume the framework TestNG also stands for Testing, the Next Generation, like Star Trek?
What is some knowledge in testing that your book gives that no one can find anywhere else?
When you think of testing of big enterprise applications and small to medium-sized applications, how are they different? What are some of the different practices that you do?
The last chapter of the book is called "Digressions" where it seems that you and Hani go into personal rants. And Hani is famous for being on the BileBlog. What are some of the rants you go into and how did that chapter come to be?
So what are some of your opinions?
show all  show all

1 comment

Reply

Conclusions about TDD a bit questionable? by Mike Bria Posted Apr 30, 2008 9:06 AM
  1. Back to top

    Conclusions about TDD a bit questionable?

    Apr 30, 2008 9:06 AM by Mike Bria

    Watching this interview with Cedric, I found myself somewhat thrown off by the some, certainly not all, of Cedric's statements. My viewpoint/experience differs from at least 3 of the points made.

    First, Cedric appears to assert that [paraphrased] "TDD frowns upon thinking about the 'macro-design'". Not so. TDD never explicitly prohibits nor prescribes that programmers think in terms of the big picture up-front - what TDD stresses is to not get too hung up on the "predicted" designs and to let the tests prove to you what the design really wants to be. Other words, go ahead and get an idea up-front, just don't spend terribly long, be flexible to it changing, and then let the red-green-clean cycle take you the rest of the way.

    Second, Cedric states that "with TDD you spend a good part of your time with code that just doesn't compile and has plenty of errors in it" implying further that "TDD negates the benefits of modern IDE's". This is absolutely false. TDD allows for only one failure (compiler or assertion based) at any given time - as soon as there's a single failure, eliminate it. Further, (for many languages) its the IDE that tells me immediately of a compiler failure and gives me great tools (auto-XYZ) to easily fix it. It's the existence then of the passing unit test(s) that allows me to leverage the IDE's refactoring tools to clean up the design.

    Third, Cedric then states that "TDD is great for junior programmers", implying TDD is less necessary for experienced programmers. TDD is a method of specifying behavior and thus driving design - it's a cognitive activity that helps drive you not only to write testable code (which it does, I agree with Cedric there), but to drive out expressive, well-factored, intention-revealing, use-driven code. I'm an experienced programmer and I find that 99 times out of 100 if I "design, code, then test", I simply don't achieve the same level of cleanliness as if I had "tested (behavior design), coded, then refactored (structure design)".

    A good debate occurred between Jim Coplien and Bob Martin along the same lines as this discussion ("TDD a must or not?"), it can be viewed here.

    I hope my remarks are seen as constructive, they're intended that way.

    Best,
    --MB

Exclusive Content

Tapestry for Nonbelievers

A new article by I. Drobiazko and R. Zubairov introduces v. 5 of the Apache Tapestry component-oriented web framework. The tutorial shows how to create a component and covers IoC in Tapestry and Ajax.

Pete Lacey on REST and Web Services

In this interview, Burton Group consultant Pete Lacey talks to Stefan Tilkov about his disillusionment with SOAP, his opinion on REST, and addresses some of the perceived shortcomings REST vs. WS-*.

Business Natural Languages Development in Ruby

Jay Fields presents his concept of Business Natural Languages - a type of Domain Specific Languages geared towards being readable by domain experts.

Distributed Version Control Systems: A Not-So-Quick Guide Through

Adoption and interest for Distributed Version Control Systems is constantly rising. We will introduce the concept of DVCS and have a look at 3 actors in the area: git, Mercurial and Bazaar.

Segundo Velasquez and Agile as Seen Through the Customer's Eyes

Deborah Hartmann interviewed Segundo Velasquez about his experience as customer with an Agile team during the initial phase of software design of a product.

Fine Grained Versioning with ClickOnce

David Cooksey shows how to fine grained versioning to a ClickOnce deployment using an HttpHandler written with ASP.NET, making partial rollouts to a test audience much easier.

Implementing Manual Activities in Windows Workflow

Windows workflow (WF) is an excellent framework for implementing business processes, but lacks support for human activities. This article describes a completely generic approach for changing this.

Markus Voelter about Software Architecture Documentation

In this interview taken during OOPSLA 2007, Markus Voelter talks about the importance of documenting the software architecture, and gives some good and also bad examples on how it could be done.