Bug 104688 - JUnit Test Runner Breaks on .aj Files
Summary: JUnit Test Runner Breaks on .aj Files
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: unspecified   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-07-21 13:02 EDT by Ron Bodkin CLA
Modified: 2006-02-20 08:14 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 Ron Bodkin CLA 2005-07-21 13:02:35 EDT
The Eclipse JUnit runner won't support .aj file extensions, failing with 
a "Can't find type" error.

I often use static inner aspects and other AspectJ-specific code in my unit 
tests. With the preferred support for .aj extensions, it's important to support 
running AspectJ unit tests.
Comment 1 Ron Bodkin CLA 2005-11-05 03:43:56 EST
Even worse, with Eclipse 3.1.1 and the latest AJDT dev builds, if I make a unit 
test with a static inner aspect have a .java extension, the JUnit test runner 
just hangs. It eventually fails like this:

Could not connect to:  : 4837			
java.net.ConnectException: Connection refused
	at jrockit.net.SocketNativeIO.connect
(Ljava.io.FileDescriptor;Ljava.net.InetAddress;III)I(Unknown Source)
	at java.net.AbstractSocketImpl.doConnect(Ljava.net.InetAddress;II)V
(Unknown Source)
	at java.net.PlainSocketImpl.doConnect(Ljava.net.InetAddress;II)V
(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Ljava.net.InetAddress;II)V
(Unknown Source)
	at java.net.PlainSocketImpl.connect(Ljava.net.SocketAddress;I)V(Unknown 
Source)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
	at java.net.Socket.connect(Socket.java:507)
	at java.net.Socket.connect(Socket.java:457)
	at java.net.Socket.<init>(Socket.java:365)
	at java.net.Socket.<init>(Socket.java:178)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.connect
(RemoteTestRunner.java:754)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:336)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
(RemoteTestRunner.java:196)
Comment 2 Matt Chapman CLA 2005-11-29 11:00:15 EST
I agree this is pretty bad, but we're not going to be able to address it in this release. The JUnit support is parsing the source code to locate the tests, so it's thrown by the .aj extension or the inner aspect. We're either going to have to propose that JUnit is made tolerant of this, or provide our own "JUnit with AspectJ support" launch config. Note that this doesn't stop you using AspectJ in unit tests (we do plenty of this ourselves), you just need to use a TestSuite class in which you add all of your unit tests.
Comment 3 Matt Chapman CLA 2006-02-20 08:14:30 EST
Fixed in 1.4.0.20060219125111 for Eclipse 3.2M5. You can now do Run As > JUnit test on .aj files.