Wednesday, July 25, 2007

Quickly disabling tests

Ever needed to disable all (or most) tests in a JUnit test case?

How about this: Using the editor of your choice, search for "void test" and replace all of them with "void dtest" ("d" as in disabled). Now, you can simply enable the few tests you need to run by deleting the "d" again.

I'm also using "x" to take out tests that won't run for a while. Using global search in the whole project, it's also simple to find them again just in case you're wondering if there are any disabled tests left.

No comments: