db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Db-derby Wiki] Update of "IntroToJUnit" by SusanCline
Date Wed, 30 Aug 2006 21:04:15 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The following page has been changed by SusanCline:
http://wiki.apache.org/db-derby/IntroToJUnit

------------------------------------------------------------------------------
  
  == JUnit tests and the Derby test harness ==
  
- I'm writing this section as someone who is new to the Derby test harness. (If someone who
is familiar with the test harness would like to edit this section, please do!)
- 
- Also, I believe there will be some changes to the way the Derby test harness uses JUnit,
for more info refer to this page.
+ There are changes being made to the way the Derby test harness uses JUnit, for more info
refer to these pages on the wiki:
+  * DerbyJUnitTesting
+  * DerbyJunitTestConfiguration, a new page that is under construction 
- 
- However, as of August 29th, 2006 this information is valid.
- 
-  1. Create a JUnit test that extends the Derby class !BaseJDBCTestCase(org.apache.derbyTesting.junit.!BaseJDBCTestCase)
and put it in the correct package name space of the Derby test harness.   For instance, org.apache.!derbyTesting.!functionTests.tests.lang
- 
-  2. Add a public constructor to your test class that takes a String argument 
- {{{
- public MathTrigFunctionsTest(String name) {
-   super(name);
- }
- }}}
- 
-  1.#3 Create a setup and teardown class which make use of some of the Base!JDBCTestCase
utilities to get the connection and use a default database.
- {{{
- ...
- 
- private Connection conn;
- 
- ...
- 
- public void setUp() throws Exception {
-   conn = BaseJDBCTestCase.getConnection();
-   conn.setAutoCommit(false);
- }
- 
- public void tearDown() throws SQLException {
-   conn.rollback();
-   conn.close();
- }
- }}}
- 
-  1.#4 Place your java class in the derby source tree in the appropriate directory according
to the package name.  For instance my Derby source directory is C:\derby_src\trunk\, so the
directory I put the !MathTrigFunctionsTest.java class is C:\derby_src\trunk\java\testing\org\apache\derbyTesting\functionTests\tests\lang

- 
-  1.#5 Make sure the Derby source classes directory, junit.jar and jakarta-oro-2.0.8.jar
files are in your class path.
- 
-  1.#6 Edit the file derbylang.runall in the $DERBY_SRC/trunk/java/testing/org/apache/derbyTesting/functionTests/suites
directory with the name of your java class, but with a .junit extension, preceded by the directory
name where the class resides.  For instance with the !MathTrigFunctionsTest which resides
in the functionTests/tests/lang directory, this is the entry in the derbylang.runall file:
- {{{
- lang/MathTrigFunctionsTest.junit
- }}}
- 
-  1.#7 To test your class
- {{{
- 	ant clobber
- 	ant all
- 	java org.apache.derbyTesting.functionTests.harness.RunTest lang/MathTrigFunctionsTest.junit

- }}}
-  1.#8 To run all the tests in the derbylang suite use this command:
- {{{
- 	java org.apache.derbyTesting.functionTests.harness.RunSuite derbylang
- }}}
  
  == Resources ==
  
@@ -681, +631 @@

   * DerbyJUnitTesting
   * DerbyJunitTestConfiguration, a new page that is under construction 
  
- Note: This may invalidate some of the stuff above about using JUnit with the Derby test
harness. 
- 
  Eclipse JUnit Getting Started
  
  Open Eclipse Help from the main menu item, select the Java Development User Guide book,
Getting Started >> Basic tutorial, Writing and running JUnit tests.

Mime
View raw message