db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-4249) Create a simple store recovery test in JUnit
Date Wed, 06 Jul 2011 20:53:16 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060830#comment-13060830

Kathey Marsden commented on DERBY-4249:

I think  ultimately we are going to want have a fixture that launches a jvm to run another
fixture that lives in the same class. So, perhaps the best way to start would be by making
a command line test runner that will run a single fixture in embedded mode.  It might be run
something like:

java org.apache.derbyTesting.functionTests.util.SingleFixtureRunner <test class> <fixture

java  org.apache.derbyTesting.functionTests.util.SingleFixtureRunner org.apache.derbyTesting.functionTests.tests.lang.SimpleTest

I think this would be a useful tool in and of itself and is something we can use for the recover
test. At least for the initial version it will be just straight embedded with no decorators.

The code would have to use reflection to kick off the fixture and on error could just print
the error info and stack trace to System.err.  It might look something like this (totally
untested and printFailInfo left as exercise).

      String testClassName = args[0];
       String fixtureName = args[1];
       Class testClass = Class.forName(testClassName);
       Constructor classConstr = testClass.getDeclaredConstructor(new Class[] {String.class});
       Test testToRun = (Test) classConstr.newInstance(new Object[] {fixtureName});
       TestResult result  = new TestResult();
       if (result.wasSuccessful())
       if (result.failureCount() > 0)
       if (result.errorCount() > 0)
If you get that done, then next we can add an assertLaunchJunitFixture() method to BaseTestCase
 which prints the error output to System.err if  the launch fails.  Then we should have all
the parts we need for the basic recovery test.

> Create a simple store recovery test in JUnit
> --------------------------------------------
>                 Key: DERBY-4249
>                 URL: https://issues.apache.org/jira/browse/DERBY-4249
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>    Affects Versions:
>            Reporter: Kathey Marsden
>            Assignee: Siddharth Srivastava
>            Priority: Minor
> It would be good to be able to start converting the store  recovery tests  or at least
be able to write new recovery tests in JUnit.   We could start by writing a simple recovery
test just to establish the framework.  The test should.
> -  Connect, create a table, commit and shutdown the database.
> -  fork a jvm, add one row, commit, add another row, exit  the jvm.
> -  Reconnect with the first jvm and verify that the first row is there and the second
is not.
> I guess the main thing to decide is how to spawn the second jvm and check results.  
 I tend to think the second jvm should actually execute another JUnit test, verify the exit
code (assuming a failed test has a non-zero exit code) and then put the output in the fail
assertion if it fails so it shows up in the report at the end of the Suite execution.   I
think we could create a test runner that takes a class and a specific test to run instead
of the whole suite, so we could keep our methods consolidated in a single class for the test,
but all pure conjecture at this point.  I'll have to give it a try, but wanted to first see
if folks thought this was a reasonable approach.

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message