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

Reply via email to