Modify

Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#13344 closed defect (fixed)

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 15 months ago.
bin2.PNG (9.2 KB) - added by Don-vip 15 months ago.

Download all attachments as: .zip

Change History (10)

Changed 15 months ago by GerdP

Attachment: eclipse-config.txt added

comment:1 Changed 15 months ago by Don-vip

Description: modified (diff)

Changed 15 months ago by Don-vip

Attachment: bin2.PNG added

comment:2 Changed 15 months ago by Don-vip

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 Changed 15 months ago by GerdP

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 Changed 15 months ago by 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.

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.

comment:5 in reply to:  4 Changed 15 months ago by GerdP

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 Changed 15 months ago by Don-vip

Milestone: 16.08

comment:7 Changed 15 months ago by Don-vip

Resolution: fixed
Status: reopenedclosed

In 10850/josm:

fix #13344 - Unable to run unit tests in Eclipse

comment:8 Changed 15 months ago by Don-vip

In 10855/josm:

see #13344 - fix checkstyle configuration with new Eclipse settings

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.