db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: Question about setting a database property only for one test fixture rather than the entire junit test
Date Thu, 14 Feb 2013 13:48:10 GMT
On 2/13/13 10:38 PM, Mamta Satoor wrote:
> Hi,
>
> I was wondering if there is a way to set a database property only for
> one test fixture within a junit test with many test fixtures. I
> recently added a test fixture xtestDerby6045 in
> org.apache.derbyTesting.functionTests.tests.lang.InListMultiProbeTest(I
> have purposely named it to start with an x because the test will fail
> until DERBY-6045 is fixed) and in that fixture, I would like to
> disable background update statistics for it setting the property
> derby.storage.indexStats.auto to false. The other fixtures in
> InListMultiProbeTest should not have background update statistics
> disabled for them. I would appreciate any pointers regarding this. I
> looked at some of the existing junit suites and see that the various
> property settings are done for the entire suite and not just one
> fixture.
>
> thanks,
> Mamta
>
Hi Mamta,

If the problem is that you want the oddball test case to share a lot of 
the same machinery as the other cases in the class, this might work:

1) Create a subclass of InListMultiProbeTest. The subclass could just be 
a nested class inside InLisMultiProbeTest. Let's call the subclass S.

2) Move the oddball test case into the subclass and add a suite() method 
to S which decorates the case in the special way you need.

3) Then _Suite.suite() can do the following:

         suite.addTest(InListMultiProbeTest.suite());
         suite.addTest(InListMultiProbeTest.S.suite());

Hope this helps,
-Rick


Mime
View raw message