I am writing some unit tests that use OnlineTestCase, the online test fixture infrastructure. OnlineTestCase provides two services: (1) configuration of online test fixtures using files in the user home directory, and (2) silencing of test fixtures whose connect() method fails.
Service (1) is good. I am happy with (1). Service (2) is, in my view, a bug, not a feature. The current behaviour of OnlineTestCase is to call connect(), and if an exception is thrown, swallow it, print a stack trace, and disable the test. This causes the test to pass when connect() fails. This is a dangerous practice because it causes unit test failures to be silent (stack traces do not count). The default maven configuration disables online tests. If online tests are being run, it typically means that the developer has explicitly turned them on using both a command-line flag and by providing a fixture properties file. It was surprising to me when my online tests silently passed when my connect() was failing. Even more frightening was the realisation that, if I broke my code, OnlineTestCase would "helpfully" disable the unit test to prevent me from being troubled by a pesky unit test failure. In my view, this defeats the purpose of a unit test. If I turn on an optional test and go to the trouble of providing a fixture properties file, and something is broken, I want to know about it. I propose to change the behaviour of OnlineTestCase so that exceptions during connect() or disconnect() are not swallowed. Yes, this will inconvenience some people who expect tests to pass when their network resources go away, but ignoring unit test failures is very dangerous practice. I know I do not have to use connect(), and could just override setUp(), but this seems to be a misuse of the class. If there is any support for my proposed change, I will make a patch and put it in Jira. -- Ben Caradoc-Davies <[EMAIL PROTECTED]> Software Engineer, CSIRO Exploration and Mining Australian Resources Research Centre 26 Dick Perry Ave, Kensington WA 6151, Australia ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel