db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Korneliussen <Andreas.Kornelius...@Sun.COM>
Subject Re: [jira] Updated: (DERBY-918) introduce a new test type to run junit tests from the current harness
Date Fri, 10 Feb 2006 08:52:13 GMT
David W. Van Couvering wrote:
> I would have added this as a patch but as I understand it the JIRA 
> comment mailer is down...
> 
> I applied this patch and everything builds fine, but I did notice that I 
> got failures with the existing Junit tests when I ran them as .junit 
> instead of .java.
> 
> Do the existing JUnit tests need to be modified somehow?  Has this 
> thread already been run and I just missed it?

Yes, they need to be modified to successfully run, since they depend on 
running some static methods to initialize some variables - otherwise 
they will give nullpointerexception.

I think I commented on that while uploading the patch.

> 
> I'm trying to find out how to validate if this patch actually works, any 
> suggestions, since it doesn't appear to come with any junit tests that 
> actually work with it.  Any suggestions?
>

You could download the the tests in 934 and run them with this patch.
--Andreas


> Thanks,
> 
> David
> 
> + java org.apache.derbyTesting.functionTests.harness.RunTest 
> junitTests/lang/Boo
> leanTest.junit
> *** Start: BooleanTest jdk1.4.2_07 2006-02-09 10:54:27 ***
> 0 add
>  > .E
>  > There was 1 error:
>  > 1) 
> testBoolean(org.apache.derbyTesting.functionTests.tests.junitTests.lang.Boo
> leanTest)java.lang.NullPointerException
> 
> *** Start: CompatibilityTest jdk1.4.2_07 2006-02-09 10:55:43 ***
> 0 add
>  > .F
>  > There was 1 failure:
>  > 1) 
> warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError: N
> o tests found in 
> org.apache.derbyTesting.functionTests.tests.junitTests.derbyNet
> .CompatibilityTest
>  > FAILURES!!!
>  > Tests run: 1,  Failures: 1,  Errors: 0
> Test Failed.
> 
> $ runtest.sh junitTests/lang/BooleanTest.java
> + java org.apache.derbyTesting.functionTests.harness.RunTest 
> junitTests/lang/Boo
> leanTest.java
> *** Start: BooleanTest jdk1.4.2_07 2006-02-09 15:49:15 ***
> *** End:   BooleanTest jdk1.4.2_07 2006-02-09 15:49:35 ***
> 
> $ runtest.sh junitTests/derbyNet/CompatibilityTest.java
> + java org.apache.derbyTesting.functionTests.harness.RunTest 
> junitTests/derbyNet
> /CompatibilityTest.java
> *** Start: CompatibilityTest jdk1.4.2_07 2006-02-09 15:48:37 ***
> 0 add
>  > java.sql.SQLException: No suitable driver
>  > Exception in thread "main"
> Test Failed.
> *** End:   CompatibilityTest jdk1.4.2_07 2006-02-09 15:48:53 ***
> 
> Andreas Korneliussen (JIRA) wrote:
> 
>>      [ http://issues.apache.org/jira/browse/DERBY-918?page=all ]
>>
>> Andreas Korneliussen updated DERBY-918:
>> ---------------------------------------
>>
>>     Attachment:     (was: DERBY-918.diff)
>>
>>
>>> introduce a new test type to run junit tests from the current harness
>>> ---------------------------------------------------------------------
>>>
>>>         Key: DERBY-918
>>>         URL: http://issues.apache.org/jira/browse/DERBY-918
>>>     Project: Derby
>>>        Type: Improvement
>>>  Components: Test
>>> Environment: All
>>>    Reporter: Andreas Korneliussen
>>>    Assignee: Andreas Korneliussen
>>
>>
>>
>>> It seems to me that for including a new JUnit test into i.e derby-all 
>>> we need to make a new java class with a main() method, which parses a 
>>> command line and set up the testsuite and run it, just like any java 
>>> program. Basically we are running the junit tests as test type "java".
>>> Instead of having to do this for every junit test going into a derby 
>>> test suite, I would propose a different strategy.
>>> I propose to introduce a new test type called "junit" (current test 
>>> types are: sql,sql2,unit,java,multi,demo - unit is not junit)
>>> Then you can use:
>>> java org.apache.derbyTesting.functionTests.harness.RunTest 
>>> <TestCaseClassName>.junit
>>> to run a Junit test - instead of:
>>> java org.apache.derbyTesting.functionTests.harness.RunTest 
>>> <AnotherClassWithMainMethod>.java
>>> When starting a test of type junit, the RunTest class may simply use the
>>> junit.textui.TestRunner class, which has a main method which takes a 
>>> TestCase class name as parameter.  The junit.textui.TestRunner  runs 
>>> the tests defined by the suite() method of the TestCase class.
>>> I think this strategy will make it easier to integrate new JUnit 
>>> tests into the current test suites, since it save you the trouble of 
>>> creating a java class with a main method for every test.
>>
>>
>>


Mime
View raw message