views:

127

answers:

6

I want to learn how to build “robust” software that is designed to test itself. In other words, how do I implement automated tests in my software ( using java or groovy or c++ ).

So I want to know where to learn this (books or websites) and which tools and libraries I will need for this?

A: 

Look at the xUnit testing frameworks (cppUnit for C++, JUnit for Java) and check out the wonderful book xUnit Test Patterns: Refactoring Test Code.

And if you really want to get into it, check out test-driven development. A good introduction is Uncle Bob's The Three Laws of TDD and the bowling game kata (see also bowling game episode). A great book on the subject is Test Driven Development: By Example.

Jason
A: 

JUnit, the automated test harness for Java, is the tool which really kicked things off. The JUnit site is an excellent place to start. It rounds up lots of articles and links to testing tools.

APC
A: 

I dunno about the "to test itself" part, but my first thought would be to read about test driven development ( http://en.wikipedia.org/wiki/Test-driven_development ) and check out JUnit.

LeguRi
+2  A: 
  • General TDD for Beginners: Kent Beck: Test Driven Development by Example
  • General Unit Testing Reference: Gerard Meszaros: xUnit Test Patterns: Refactoring Test Code
  • TDD for greenfield projects: Steve Freeman, Nat Pryce: Growing Object-Oriented Software, Guided by Tests
  • TDD for brownfield projects: Micheal Feathers: Working Effectively with Legacy Code
  • Q&A for testing problems: http://www.stackoverflow.com + http://testing.stackexchange.com/
  • Software list (scroll down)
EricSchaefer
+1 -- The Beck volume is very helpful.
Dave Sims
+1  A: 

In addition to the aforementioned test-driven development (TDD) technique, you could give a look at design by contract, another technique where, basically, one add assertions in the production code to validate at runtime that the contract clauses (inputs, outputs and invariants) between the components are respected. These assertions can be removed, or kept, when the software is delivered.

I'd like to augment my answer to make clear that TDD does not lead to "software that is designed to test itself", but some software, - the unit tests suite, grown along with the production code, that tests another piece of software.

philippe
A: 

I found The Art of Unit Testing by Roy Osherove to be very helpful in understanding the basics of unit testing, integeration testing, TDD and so on. It's a bit tailored for .Net languages, but it also provides very good information on the ideas behind automated testing.

Anne Schuessler