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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: