Wednesday, September 21, 2005

Boundary test

How often you find yourselves writing a unit test that really tests an external system, like database, external web service, etc.? XP does not recommend to write such tests, and recommends instead to write a harness for database, web service, etc. The reasoning is very simple: these tests are easier to write, they run much faster and testing only the code you wrote, not the code of third party. However I still believe there is a great value in these tests, which I will call boundary tests to distinguish it from unit tests, which are usually layer tests. The value of boundary tests is in testing connectivity to the services your application relies on. And if you use the principle of testing anything that can possible break, I can guarantee that connectivity to external services (and the services themselves!) break as often (or even more often) than the code we are writing.

No comments: