db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Workaround for running JUnit tests with the GUI runners (was: Re: [junit] Making progess faster towards a pure Junit world)
Date Tue, 17 Oct 2006 15:41:18 GMT
Dyre.Tjeldvoll@Sun.COM wrote:
> Kristian Waagan <Kristian.Waagan@Sun.COM> writes:
> 
>> Daniel John Debrunner wrote:

[ snip - progress towards a pure JUnit world ]

> 
> Should it be possible to run junit tests with ALL the junit runners,
> or just with junit.textui.TestRunner? 
> 
> With the current trunk I able to
> run
> 
> org.apache.derbyTesting.functionTests.tests.jdbcapi._Suite
> 
> successfully with junit.textui.TestRunner (if I set
> derby.system.home), but with 
> junit.awtui.TestRunner or junit.swingui.TestRunner the first test
> fails with 
> 
> java.lang.ExceptionInInitializerError
> 	at org.apache.derbyTesting.junit.TestConfiguration.defaultSecurityManagerSetup(TestConfiguration.java:667)
> 	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:73)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
> 	at junit.extensions.TestSetup.run(TestSetup.java:23)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
> 	at junit.extensions.TestSetup.run(TestSetup.java:23)
> Caused by: java.lang.NullPointerException
> 	at org.apache.derbyTesting.junit.SecurityManagerSetup.determineClasspath(SecurityManagerSetup.java:218)
> 	at org.apache.derbyTesting.junit.SecurityManagerSetup.<clinit>(SecurityManagerSetup.java:56)
> 	... 19 more
> 
> and the following tests fail with
> 
> java.lang.NoClassDefFoundError: Could not initialize class org.apache.derbyTesting.junit.SecurityManagerSetup
> 	at org.apache.derbyTesting.junit.TestConfiguration.defaultSecurityManagerSetup(TestConfiguration.java:667)
> 	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:73)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
> 	at junit.extensions.TestSetup.run(TestSetup.java:23)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
> 	at junit.extensions.TestSetup.run(TestSetup.java:23)
> 
> Should I create a JIRA for this?

Hi Dyre,

I think you can create a Jira for this, if you haven't already.

The problem is that the GUI runners are using a custom classload to 
allow for dynamic reloading of the test classes. It defeats the getURL 
method in SecurityManagerSetup, seemingly by returning an empty/null 
(the object itself isn't null) ProtectionDomain object. This finally 
leads to the URL object extracted being null, which causes the NPE.

A workaround is to specify the -noloading option for the runner, like this:
java -classpath X junit.swingui.TestRunner -noloading 
org.apache.derbyTesting...

If you do this, you must restart the GUI if you recompile the test classes.
We should investigate this and see if we can get it working without 
specifying the -noloading argument.



-- 
Kristian

> 


Mime
View raw message