On 7/7/06, Manish Khettry <[EMAIL PROTECTED]> wrote:
a) Are issues with JUnit sorted out? Is it OK to use JUnit?
Yes, it is OK to use junit. There are a number of junit tests that are already a part of derbyall. The main thing to remember when writing a new junit test is that when adding the test to an existing suite, you should change the test's extension to .junit in the .runall suite file. That way, the test harness invokes the test using junit and not the test class' main method.
b) I take it DerbyJUnitTest is deprecated. This class does have some useful methods like assertRow/assertScalar etc which I will need. Is it OK to copy these methods and/or add similar utility methods in BaseJDBCTestCase?
Yes, you should feel free to add any utility methods to BaseJDBCTestCase that you find useful, and feel free to copy any methods from DerbyJUnitTest over that you need. Note that there are two Base classes, BaseTestCase and BaseJDBCTestCase. I'm not sure I'm entirely clear on the split, it might be best to review the discussion on the list surrounding their creation and separation. I think generic configuration and utility methods go into BaseTestCase and utility methods for exercising JDBC methods go into BaseJDBCTestCase. So something like assertRow() in DerbyJUnitTest would probably go into BaseJDBCTestCase, whereas something like println() or alarm() would go into BaseTestCase.
c)Are there good examples among our existing JUnit test cases to follow? Any do's or don'ts before I go up the wrong path?
I think there might be some basic information in java/testing/README.htm. At the end of this mail is a list of all the current junit tests.
d)If DerbyJUnitTest is deprecated, shouldn't it be removed and its subclasses rewritten to use BaseJDBCTestCase (or atleast marked as deprecated)?!
Yes, it should. I believe that currently the only test that depends on it is junitTests/compatibility/CompatibilitySuite.java. Rick Hillegass had tasked himself with converting the test over to the new BaseJDBCTestCase, but I suppose he's been busy with other things lately. I don't think there's a JIRA issue for tracking it, but maybe there should be. There was also some discussion about this around the same time as the creation of BaseJDBCTestCase. Hope that helps, andrew A list of tests currently in suites. These tests are in java/testing/org/apache/derbyTesting/functionTests/tests (but with the .java extension of course): derbynet/SqlExceptionTest.junit junitTests/derbyNet/OwnServerTests.junit jdbc4/AutoloadTest.junit jdbc4/BlobTest.junit jdbc4/CallableStatementTest.junit jdbc4/ClobTest.junit jdbc4/ClosedObjectTest.junit jdbc4/ConnectionTest.junit jdbc4/DataSourceTest.junit jdbc4/ParameterMetaDataWrapperTest.junit jdbc4/PreparedStatementTest.junit jdbc4/ResultSetMetaDataTest.junit jdbc4/ResultSetTest.junit jdbc4/RowIdNotImplementedTest.junit jdbc4/StatementEventsTest.junit jdbc4/StatementTest.junit jdbc4/UnsupportedVetter.junit jdbc4/VerifySignatures.junit jdbc4/XA40Test.junit jdbcapi/HoldabilityTest.junit jdbcapi/ProcedureTest.junit jdbcapi/UpdateXXXTest.junit jdbcapi/SURQueryMixTest.junit jdbcapi/SURTest.junit jdbcapi/ScrollResultSetTest.junit jdbcapi/URCoveringIndexTest.junit