Bug 98214 - Tests excluded from build are still searched for by junit runner
Summary: Tests excluded from build are still searched for by junit runner
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: UI (show other bugs)
Version: 1.2.0 M2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.4.0 M1   Edit
Assignee: Matt Chapman CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-02 19:55 EDT by Barry Kaplan CLA
Modified: 2006-02-20 10:41 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barry Kaplan CLA 2005-06-02 19:55:06 EDT
The adjt "enhanced" build configuration management is not compatible with the
junit-runner. When tests are excluded (via the aspejctj context menu actions)
the junit-runner still searches for them, throwing either ClassNotFound
exceptions or NullPointException from its internal code.

There seems to be no workaround. The adjt configuraiton cannot exclude the
tests, yet adjt has disabled the standard java nature method of exluding files
from the build path.
Comment 1 Matt Chapman CLA 2005-07-01 06:33:20 EDT
Barry,
Please could you expand on the steps necessary to reproduce this. If I exclude a
test, I see that I can still select Run As > JUnit test on it, which I shouldn't
be able to do. So that is a bug, but a minor one, as it involves explicitly
trying to run an excluded test, something you wouldn't normally do. However your
description makes the problem sound more serious. If you want to exclude a test,
can you not just remove it from the JUnit test suite?
Comment 2 Barry Kaplan CLA 2005-07-01 10:05:26 EDT
I don't use explicit suites. I let the junit plugin search for them since I am
either running just the one test I'm working on, or running all tests. So I tend
to setup a junit run target for an entire directory or project. For most
projects I have only two targets: one that runs all unit-tests (in directory
utest) and one that runs all functional tests (in directory ftest).

So to reproduce: Create a junit run target with the "run all tests in selected
project..." selected. Exclude a [failing] test. And run. (I admit that I have
not tested this just now as I describe it. But this is how the problem surfaced
when I reported it.)

(Maybe off topic, maybe not: Why does the aspectj nature need to change the
default java behavior for excludes? Only to get around limitations with the
compiler?)
Comment 3 Matt Chapman CLA 2005-07-01 12:04:13 EDT
I see the problem now - I didn't know you could do that (we always use test suites).

Your comment about having different behaviour to JDT is very much on topic here.
The reasons for this are partly historical: AJDT added support for direct
manipulation of the build path from context menus in the package explorer and
named build configurations files, at a time when JDT supported neither. As of
Eclipse 3.1, JDT now supports the first capability via a new Build Path entry on
the context menu. But it still doesn't support the second, which is of
particular importance to AspectJ projects, as it allows the creation of multiple
build configurations with and without certain aspects, so you can create a debug
configuration etc. Longer term (in the Eclipse 3.2 timeframe) we hope to
persuade JDT to add support for named configurations, at which point we can take
out the AJDT support, and problems such as this will go away.

It would be difficult to do anything about this on Eclipse 3.0 because of the
missing JDT function there, so I'm going to target this for the Eclipse 3.1
release (AJDT 1.3). The best we could hope for there would be to switch to JDT's
include/exclude mechanism, and re-implement the named configuration support on
top of that (and then contribute that support to JDT if they want it).
Comment 4 Barry Kaplan CLA 2005-07-01 14:43:01 EDT
All fine by me. I use only 3.1 in any case. And will almost certainly move to
3.2.Mx as soon as I can. Thanks.
Comment 5 Matt Chapman CLA 2005-11-15 08:49:33 EST
The results of my investigations are not great - JDT's include/exclude mechanism
cannot operate on .aj files, so it is not possible to address this for AJDT 1.3
on Eclipse 3.1. We are pushing hard to progress this in the Eclipse 3.2
timeframe. It is part of many changes which together will bring a great deal of
benefit to AJDT. Relevant JDT bugs include:
115067 - add getJavaLikeExtensions style API to JDT/Core
89977 - make JDT/UI cope with compilation units with non-.java extensions
71460 - associate Java contents with non *.java files
36939 - Improve support for Java-like source files
Comment 6 Matt Chapman CLA 2006-02-20 08:19:52 EST
Fixed in 1.4.0.20060219125111 for Eclipse 3.2M5.
AJDT now uses the JDT include/exclude mechanism, so excluded tests really are excluded. See the new features page for more info: http://www.eclipse.org/ajdt/newfeatures/
Comment 7 Barry Kaplan CLA 2006-02-20 10:41:30 EST
Very sweet Matt. Thanks much!