InfoQ

Interview

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
Unit Testing ,
Software Testing
Tags
TDD ,
TestNG ,
Design Patterns ,
Testing
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
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

Educational Content

Bindings, Platforms, and Innovation

This presentation focuses on the Internet and separating myth from fact, history from the future, and the mundane from the imaginative. Bob Frankston presents a vision of what could and should be.

Orchestrating Long Running Activities with JBoss / JBPM

This article explores the use of JBoss and jBPM to implement design solutions that effectively address the issue of orchestrating long running activities.

Neo4j - The Benefits of Graph Databases

This presentation covers the use of graph databases as an optimal solution for data that is difficult to fit in static tables, rapidly evolving data or data that has a lot of optional attributes.

Realistic about Risk: Software development with Real Options

This session introduces Real Options and shows how it can help in running your project. Real Options is a decision-making process that can be used to manage risk.

Communication Flexibility Using Bindings

This article discusses the use of bindings on services and references (including the instance of non-configured bindings) as the means to implement SCA communications in a Web and SOA environment.

Writing DSLs in Groovy

After a short introduction to DSLs, Scott Davis plays with the keyboard showing how to approach the creation of a DSL by typing working snippets of Groovy code that get executed.

Scaling Agile with C/ALM (Collaborative Application Lifecycle Management)

IBM Rational and InfoQ present, Scaling Agile with C/ALM, an eBook showing organizations how to become “finely tuned software delivery machines” by enabling team integration and scaling.

Concurrent Programming with Microsoft F#

Amanda Laucher presents a real life enterprise application written in F#. She shows actual code snippets, explaining design decisions and suggesting how to use some of the F# constructs.