Modify

Opened 8 years ago

Last modified 8 days ago

#13344 reopened defect

Unable to run unit tests in Eclipse on Windows

Reported by: GerdP Owned by: team
Priority: normal Milestone: 16.08
Component: Unit tests Version:
Keywords: eclipse Cc:

Description (last modified by Don-vip)

I try to execute the test MultipolygonTestTest.
I have the source in the edit window and do a right click into the window, then select
Run as -> JUnit test

This is what I get:
ERROR: java.io.IOException: Failed to open input stream for resource 'resource://data/preferences.xsd'
java.io.IOException: Failed to open input stream for resource 'resource://data/preferences.xsd'
	at org.openstreetmap.josm.io.CachedFile.getInputStream(CachedFile.java:214)
	at org.openstreetmap.josm.data.preferences.PreferencesReader.validateXML(PreferencesReader.java:95)
	at org.openstreetmap.josm.data.preferences.PreferencesReader.validateXML(PreferencesReader.java:84)
	at org.openstreetmap.josm.data.Preferences.load(Preferences.java:572)
	at org.openstreetmap.josm.data.Preferences.init(Preferences.java:678)
	at org.openstreetmap.josm.JOSMFixture.init(JOSMFixture.java:102)
	at org.openstreetmap.josm.data.validation.tests.MultipolygonTestTest.setUp(MultipolygonTestTest.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Attachments (2)

eclipse-config.txt (566.0 KB ) - added by GerdP 8 years ago.
bin2.PNG (9.2 KB ) - added by Don-vip 8 years ago.

Download all attachments as: .zip

Change History (11)

by GerdP, 8 years ago

Attachment: eclipse-config.txt added

comment:1 by Don-vip, 8 years ago

Description: modified (diff)

by Don-vip, 8 years ago

Attachment: bin2.PNG added

comment:2 by Don-vip, 8 years ago

Keywords: eclipse added
Resolution: worksforme
Status: newclosed

It's currently a bit tricky due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=127994, you must add bin2 directory to the runtime classpath of your run/debug configurations:


comment:3 by GerdP, 8 years ago

Resolution: worksforme
Status: closedreopened

OK, that takes me to the next problem: How do I configure the url within eclipse?
I guess I can change the url in the source, but maybe there is a better solution?

java.lang.AssertionError: configured server url 'https://api.openstreetmap.org/api/' seems to be a productive url, aborting.

at org.junit.Assert.fail(Assert.java:88)
at org.openstreetmap.josm.JOSMFixture.init(JOSMFixture.java:119)
at org.openstreetmap.josm.data.validation.tests.MultipolygonTestTest.setUp(MultipolygonTestTest.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

comment:4 by michael2402, 8 years ago

I had the same problem when starting to test. Those are the patches I use:
https://github.com/michaelzangl/josm/commits/mirror-patched

You may be interested in:

  • Make tests runnable from eclipse.
  • Use dev server for tests.
  • Make test clean delete more.

I did not submit them as patch since they may break other things ;-)

The remaining changes are for setting my local java version and setting up travis.

in reply to:  4 comment:5 by GerdP, 8 years ago

Replying to michael2402:

I had the same problem when starting to test. Those are the patches I use:
https://github.com/michaelzangl/josm/commits/mirror-patched

You may be interested in:

  • Make tests runnable from eclipse.
  • Use dev server for tests.
  • Make test clean delete more.

Thanks, that helped a lot.

comment:6 by Don-vip, 8 years ago

Milestone: 16.08

comment:7 by Don-vip, 8 years ago

Resolution: fixed
Status: reopenedclosed

In 10850/josm:

fix #13344 - Unable to run unit tests in Eclipse

comment:8 by Don-vip, 8 years ago

In 10855/josm:

see #13344 - fix checkstyle configuration with new Eclipse settings

comment:9 by anonymous, 8 days ago

Resolution: fixed
Status: closedreopened

Modify Ticket

Change Properties
Set your email in Preferences
Action
as reopened The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user. Next status will be 'new'.
Next status will be 'needinfo'. The owner will be changed from team to GerdP.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.