JUnit Pattern Matching

In the current IDEA 10 JUnit Run/Debug configuration, there is a "Pattern" option, which as far as I understand it, only allows a pipe separated list of fully qualified class names. Which this is handy, it would be most excellent if it could also accept type globs.

So for instance, if I have a project which defines different sets of tests based on a naming convention, I could simply define a JUnit Run/Debug Configuration for each of the naming conventions, for instance com.company.*.*UnitTest and com.company.*.*IntegrationTest, etc., and have the test runner pick up the current list of classes matching the pattern before each run.

The pain we currently have is that we have many many tests in each category, so it is difficult to create configurations which include some tests and exclude others.

How do other developers deal with this? We would prefer not to separate our tests into separate test source roots for each different type of test.

Thanks!

--Peter

3 comments
Comment actions Permalink

Please check http://youtrack.jetbrains.net/issue/IDEABKL-297 .

You can probably create test suite class which will run the list of tests you need.

0
Comment actions Permalink

Ah, I get it.

"Use a workaround, this request was made six years ago, and we're not going to do it"

The issue with a TestSuite class, is that again, we need to actually maintain the TestSuite. It would be nice to have the IDE automatically pick up new tests as they're added to the repository on each run.

Thanks anyway! About par for the course in my experience in dealing with JetBrains. Great product, but the people who offer customer support seem indifferent to customer requests.

--Peter

0
Comment actions Permalink

This also is a limitation of JUnit. Writing a suite that lists all elements it contains instead of attaching that information to the tests themselves seems like doing things backwards. Naming patterns can be a good solution, although not from IDEA as you mentioned. I'm using them a lot, also for breaking unit tests of classes into smaller pieces (e.g. basic functionality, event related functionality, ...).

0

Please sign in to leave a comment.