You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Daniel John Debrunner <dj...@apache.org> on 2006/08/13 19:15:03 UTC

[junit] jdbcapi suite runs JUnit tests as a suite, not as individual tests.

With revision 431195 I modified the old test harness jdbcapi.runall
suite to run most of its JUnit tests through the single test/suite
jdbcapi._Suite. This _Suite can also be run directly by JUnit test
runners, though that yet does not install the security manager. The two
JUnit tests left in jdbcapi.runall are just because I didn't get round
to them, I think they were added after I created the _Suite (or I missed
them).

I have changes that enable the security manager for JUnit tests when run
standalone by JUnit test runners, but I need to test them more. (See
BaseTestCase.runBare).

This is a minor step in the direction of JUnit, more a sanity check to
see if there are any problems running tests like this.

I'll check the tinderbox builds later.

Dan.


Committed revision 431195.

Have the test harness jdbcapi run a single JUnit suite jdbcapi._Suite
that includes most of the JUnit tests
that were run individually. Tests in this suite that were excluded in
derby net or had _app.properties file
now self-exclude themselves based upon the JUnit utility methods
indicating which JDBC client they are running.
Remaining JUnit tests should be included in jdbcapi._Suite, think they
were added after I has started the _Suite
work.


Re: [junit] jdbcapi suite runs JUnit tests as a suite, not as individual tests.

Posted by Daniel John Debrunner <dj...@apache.org>.
Kristian Waagan wrote:

> Daniel John Debrunner wrote:
> 
>> With revision 431195 I modified the old test harness jdbcapi.runall
>> suite to run most of its JUnit tests through the single test/suite
>> jdbcapi._Suite. This _Suite can also be run directly by JUnit test
>> runners, though that yet does not install the security manager. The two
>> JUnit tests left in jdbcapi.runall are just because I didn't get round
>> to them, I think they were added after I created the _Suite (or I missed
>> them).
> 
> 
> Hi Dan,
> 
> I see that tests are added in two different ways; either with
> TestSuite.addTest(ATestClass.suite()) and
> TestSuite.addTestSuite(SomeTestClass.class). Now, if I decide to add a
> suite-method to SomeTestClass, then the logic I put into it will not be
> executed if I forget to update the _Suite.suite-method.
> 
> Is this something we should:
>  a) catch during review
>  b) document in a checklist or similar
>  c) see if JUnit already has functionality for
>  d) write a utility method for, that checks for a suite-method and uses
> it if it is available

I hit this problem during the switch to _Suite and I noticed it when the
logic I had added was not executed, ie. the _Suite test continued to
fail when running with the DB2 client. So that's one way of checking. :-)

I would exclude d) as an option as I believe that adding JUnit tests in
Derby should fit the typical JUnit pattern so that others used to JUnit
don't have to learn new tricks.

Dan.



Re: [junit] jdbcapi suite runs JUnit tests as a suite, not as individual tests.

Posted by Kristian Waagan <Kr...@Sun.COM>.
Daniel John Debrunner wrote:
> With revision 431195 I modified the old test harness jdbcapi.runall
> suite to run most of its JUnit tests through the single test/suite
> jdbcapi._Suite. This _Suite can also be run directly by JUnit test
> runners, though that yet does not install the security manager. The two
> JUnit tests left in jdbcapi.runall are just because I didn't get round
> to them, I think they were added after I created the _Suite (or I missed
> them).

Hi Dan,

I see that tests are added in two different ways; either with 
TestSuite.addTest(ATestClass.suite()) and 
TestSuite.addTestSuite(SomeTestClass.class). Now, if I decide to add a 
suite-method to SomeTestClass, then the logic I put into it will not be 
executed if I forget to update the _Suite.suite-method.

Is this something we should:
  a) catch during review
  b) document in a checklist or similar
  c) see if JUnit already has functionality for
  d) write a utility method for, that checks for a suite-method and uses 
it if it is available


I don't think it is a problem if you remove the suite-method of a test 
class, as this will be caught at compile-time.




Regards,
-- 
Kristian

> 
> I have changes that enable the security manager for JUnit tests when run
> standalone by JUnit test runners, but I need to test them more. (See
> BaseTestCase.runBare).
> 
> This is a minor step in the direction of JUnit, more a sanity check to
> see if there are any problems running tests like this.
> 
> I'll check the tinderbox builds later.
> 
> Dan.
> 
> 
> Committed revision 431195.
> 
> Have the test harness jdbcapi run a single JUnit suite jdbcapi._Suite
> that includes most of the JUnit tests
> that were run individually. Tests in this suite that were excluded in
> derby net or had _app.properties file
> now self-exclude themselves based upon the JUnit utility methods
> indicating which JDBC client they are running.
> Remaining JUnit tests should be included in jdbcapi._Suite, think they
> were added after I has started the _Suite
> work.
>