Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am rereading Refactoring by Martin Fowler. In Chapter 4, Building Tests, I came across the following passage.

In fact, one of the most usefull times to write tests is before you start programming. When you need to add a feature, begin by writing the test. This isn't as backward as it sounds. By writing the test you are asking yourself what needs to be done to add the function. Writing the test also concentrates on the interface rather than the implementation (always a good thing). It also means you have a clear point at which you are done coding--when the test works.

While I am an advocate of test-driven development now, I did not remember having been introduced to the concept when I originally read this book nearly 5 years ago.

According to Amazon.com, this book was originally published on July 8, 1999. Is this the first published reference to test-first programming or is there something even earlier?

share|improve this question
    
It's not subjective. Is it relevant? I don't think so. If you have a good motive to reopen this question, post on meta.programmers.stackexchange.com –  bigown Sep 29 '10 at 20:50
    
@bigown: I am not sure I understand. Are you saying that you closed this question because it is not subjective or that it is not relative? –  Eric Weilnau Sep 30 '10 at 1:50
    
It's clearly objective. –  bigown Sep 30 '10 at 2:06
2  
It's also programming related and interesting, and although there may be one true answer, proving it is not easy. Where else does it go? ProgrammingHistory.stackexchange? –  AShelly Sep 30 '10 at 17:15
4  
we can allow objective questions here -- we prefer subjective questions but just like Stack Overflow has some SUBJECTIVE questions that survive, this site can have some OBJECTIVE questions that survive. (I would not expect to see any "how do I get this Perl code to work" questions here, though) –  Jeff Atwood Sep 30 '10 at 21:52
add comment

3 Answers

up vote 3 down vote accepted

Jon Bently in Programming Pearls (originaly published 1986) does not specifically mention Test-First programming. But in the chapter "Writing Correct Programs", he describes writing an algorithm by first defining the preconditions, invariants and postconditions, and in the next chapter describes an automated testing framework.

It's not quite test-first, but he was definitely laying some of the groundwork.

Also,

CIO Magazine, March 1993, Bug Busters, by Lucie Juneau, pg 84:

Test cases ... can be developed even before any code has been written. Ideally these cases are based on an application's requirements ... If developers are given requirements-based tests before they begin to write code, they will design a product that can pass those tests ... "

share|improve this answer
    
The 2nd edition was published on Oct 7, 1999 according to Amazon.com. The 1st edition was published sometime in 1986. Was this reference in the 1st edition? –  Eric Weilnau Sep 29 '10 at 20:17
    
I have only read the 2nd edition. The preface seems to indicate that the only the "Writing Correct Programs" chapter was in the 1st edition, the automated testing chapter is newer. –  AShelly Sep 30 '10 at 16:00
add comment

That was Kent Beck, in his book Extreme Programming, also published in 1999.

alt text

share|improve this answer
    
According to Amazon.com, this book was originally published on Oct 5, 1999. This is nearly 3 months after Refactoring was published. I have edited my question to include the exact date of publication according to Amazon.com. I have not read Kent's book but assume that it provides far more information on test-first programming. –  Eric Weilnau Sep 29 '10 at 14:14
3  
It's interesting that the back cover of that book says Kent Beck "helped pioneer.. the rediscovery of test-first programming." Where did he rediscover it from? –  AShelly Sep 29 '10 at 17:04
    
Interesting finding AShelly! –  user2567 Sep 29 '10 at 17:47
1  
@AShelly: A couple of years ago Kent Beck gave a keynote at RailsConf. In it he described how he came up with TDD and he mentions that he read about it in an old article from the 60s. –  Jörg W Mittag Dec 10 '11 at 4:50
add comment

Test driven development is similar to design by contract, where you have preconditions, invariants and postconditions.

The term was coined by Bertrand Meyer in connection with his design of the Eiffel programming language and first described in various articles starting in 1986 [Wikipedia]

Formal methods date from at least 1983, and have been used for safety critical systems such as the driverless Paris metro using the B-method:

In the first and the most abstract version, which is called Abstract Machine, designer should specify the goal of the design. [Wikipedia]

These could be some of the things from which Kent Beck "helped pioneer... the rediscovery of test-first programming".

More to the point: Apparently Nasa's early 1960s Project Mercury was the first software project using test-driven development and other agile practices. I couldn't find any early documentation, but here's a 2003 report that quotes project members' communication:

Project Mercury ran with very short (half-day) iterations that were time boxed. The development team conducted a technical review of all changes, and, interestingly, applied the Extreme Programming practice of test-first development, planning and writing tests before each micro-increment.

The rest of the report is interesting too, it goes on to say:

The earliest reference we found that specifically focused on describing and recommending iterative development was a 1968 report from Brian Randell and F.W. Zurcher at the IBM T.J. Watson Research.

In addition to automated testing, the 1968 report advocates parallel coding and testing, if not test-first:

g. Detail design, coding and documentation of each program block.
h. Design and documentation of test methods for each program block in parallel with step (g).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.