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 Mamta Satoor <ms...@gmail.com> on 2013/02/14 07:38:16 UTC
Question about setting a database property only for one test fixture
rather than the entire junit test
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
Re: Question about setting a database property only for one test
fixture rather than the entire junit test
Posted by Mamta Satoor <ms...@gmail.com>.
Hi Rick,
Thanks for your response. I will give this approach a try if we decide
to use a property just for that one test.
thanks again,
Mamta
On Thu, Feb 14, 2013 at 5:48 AM, Rick Hillegas <ri...@oracle.com> wrote:
> 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
>
Re: Question about setting a database property only for one test
fixture rather than the entire junit test
Posted by Rick Hillegas <ri...@oracle.com>.
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