Hi,
I am trying to run the JUnit tests in
org.eclipse.osgi.tests.framework. When I try to run any of the AllTests
files (org.eclipse.osgi.tests.framework.classpath.AllTests, for example), all
of the tests fail. For the failures, I see something like the following
for the failure trace:
junit.framework.AssertionFailedError: Exception in
constructor: testNoClassPath (java.lang.NullPointerException
at
org.eclipse.osgi.tests.framework.AbstractFrameworkTest.<init>(AbstractFrameworkTest.java:37)
at
org.eclipse.osgi.tests.framework.classpath.AllTests.<init>(AllTests.java:20)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:44)
at
java.lang.reflect.Constructor.newInstance(Constructor.java:315)
at
junit.framework.TestSuite.createTest(TestSuite.java:135)
at
junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
at
junit.framework.TestSuite.<init>(TestSuite.java:75)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:399)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
)
at
junit.framework.Assert.fail(Assert.java:47)
at
junit.framework.TestSuite$1.runTest(TestSuite.java:263)
at
junit.framework.TestCase.runBare(TestCase.java:127)
at
junit.framework.TestResult$1.protect(TestResult.java:106)
at
junit.framework.TestResult.runProtected(TestResult.java:124)
at
junit.framework.TestResult.run(TestResult.java:109)
at
junit.framework.TestCase.run(TestCase.java:118)
at
junit.framework.TestSuite.runTest(TestSuite.java:208)
at
junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
I haven’t changed any of the code in the org.eclipse.osgi
project yet, so I thought the tests should work. It seems like the call
to FrameworkPlugin.getDefault().getContext() at line 37 in
org.eclipse.osgi.tests.framework.AbstractFrameworkTest.java causes this
error. Is there something I’m doing incorrectly? I don’t
have much experience with JUnit yet, so it wouldn’t surprise me if I’m
forgetting to do something.
I also have a more general question about testing the
framework. What is the difference between org.eclipse.tests.framework and
org.eclipse.tests?
Thanks,
Arjun