Bug 121118 - [JUnit]: Can't set a filter for tests to run
Summary: [JUnit]: Can't set a filter for tests to run
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-15 16:02 EST by Marcio CLA
Modified: 2006-08-30 07:32 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcio CLA 2005-12-15 16:02:36 EST
It is nice to be able to right-click on the src folder and run the JUnit tests. Unfortunately I have Cactus JUnit tests too, and they have to be launched in a special way. Ant knows how to do it, but Eclipse doesn't.

With that in mind, there's a need to tell Eclipse to launch "all JUnit tests that are not Cactus junit tests". This is done from Ant via regular filters, like "**/junit/*.java" etc.

Therefore, I'd like to request that the JUnit plugin in Eclipse be changed to incorporate the notion of filters like in Ant. This way I could easily create a launch configuration that represents "all JUnit tests that are not Cactus tests". This could be done with an extra widget for the filter text expression, and the code would actually use the filter when traversing everything under "src".
Comment 1 Tobias Widmer CLA 2005-12-16 03:36:31 EST
Markus, any comments?
Comment 2 Markus Keller CLA 2005-12-16 04:31:35 EST
Can't you put these not-pure-JUnit tests into a separate source folder?
Comment 3 Marcio CLA 2005-12-16 10:08:42 EST
If you send me detailed steps I cam try, but I suspect that it will break our build entirely. You see, we have Ant tasks to compile the code, JAR it, run JDepend on the source, run JavaNCSS on the source, run Findbugs on the source, instrument the code with Emma (code coverage) etc and produce 1 consolidated report from each tool. We run these tools on the actual app code and test code. These tools assume a sources dir, not multiple sources dir.

Eclipse has tight integration with Ant, and has tight integration with JUnit, but not both at the same time, as we can see here. My Ant tasks run perfectly fine in Eclipse, they know how to run the pure JUnit tests (API tests that run outside the servlet container) and the Cactus tests (tests that need to run inside the servler container). But from teh JUnit GUI / plugin, it is another story...

One option is to fix the JUnit plugin so that it knows how to properly run the Cactus tests as well (too hard, you need to cactify a WAR etc), or at least knows how to recognize them and ignore them when running from the Eclipse GUI (do you really want to hardcode Cactuis knowledge?).

I think the SimplestThingThatCouldPossiblyWork is to add support for filters and let users teach Eclipse what tests it should skip because it just doesn't know how to handle properly. Simple and clean.





Comment 4 Markus Keller CLA 2006-06-06 10:26:43 EDT
Bug 40598 also wants to modify the set of tests to be executed from a container.
Comment 5 Mike Haller CLA 2006-08-30 07:32:00 EDT
Would like to have a filter for test to run. Some external projects have conventions like *TestManual for TestCases which should only be run manually. Another request is to exclude Abstract Test Cases, e.g. Abstract*Test.

Build tools like Maven have such filters, why not Eclipse too?