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
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

Using Ruby Fibers for Async I/O: NeverBlock and Revactor

Ruby 1.9's Fibers and non-blocking I/O are getting more attention - we talked to Mohammad A. Ali of the NeverBlock project and Tony Arcieri of the Revactor project.

Agile and Beyond - The Power of Aspirational Teams

Tim Mackinnon talks about the aspirations behind the Agile principles and practices, the desire to become efficient, to write quality code which does not end up being thrown away.

Concurrency: Past and Present

Brian Goetz discusses the difficulties of creating multithreaded programs correctly, incorrect synchronization, race conditions, deadlock, STM, concurrency, alternatives to threads, Erlang, Scala.

ActionScript 3 for Java Programmers

Often the hardest part of changing technologies is language syntax differences. This new article provides Java developers with a transition guide to Actionscript which forms the foundation of Flex.

Neal Ford On Programming Languages and Platforms

Neal Ford talks about having multiple languages running on one of the two major platforms: Java and .NET. He also presents the advantages offered by Ruby compared to static languages like Java or C#.

Future Directions for Agile

David Anderson talks about the history of Agile, the current status of it and his vision for the future. The role of Agile consists in finding ways to implement its principles.

Nick Sieger on JRuby

Nick Sieger talks about the future of JRuby, Java Integration, and his work on JEE deployment tools for Ruby on Rails like Warbler.

Rustan Leino and Mike Barnett on Spec#

Rustan Leino and Mike Barnett of Microsoft Research discuss the technology in Spec# and its futures.