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 "DerbyJunitTestConfiguration" by DanDebrunner
Date Tue, 17 Oct 2006 16:25:47 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 DanDebrunner:
http://wiki.apache.org/db-derby/DerbyJunitTestConfiguration

------------------------------------------------------------------------------
  
  Derby's JUnit tests will be self-contained for the primary configurations which are:
   * embedded
-  * derby network client
+  * derby client
  
  This means that each test's `suite()` method will return a suite that runs test fixtures
in all the primary configurations
  as required. This is option B in this derby-dev discussion:
@@ -24, +24 @@

   * client only - E.g. specific testing of a client data source
  
  Here are examples of how to write the `suite()` method for the test class `MyTest` for various
combinations.
- Any tests that are added into a suite without any client server decorator will run as embedded.
+ Any tests that are added into a suite without any client server decorator will run the fixtures
only as embedded.
+ 
+ It's also useful to look at actual test classes to see how various other situations are
handled.
  
  === All test fixtures running as embedded and client ===
+ <!> Note this default suite setup includes a !CleanDatabaseTestSetup.
  {{{
  public Test suite() {
     return TestConfiguration.defaultSuite(MyTest.class);
  }
  }}}
+ === All fixtures running as embedded and client but some based upon JDBC level ===
+ <!> Note manually added !CleanDatabaseTestSetup.
+ {{{
+ public Test suite() {
+     TestSuite suite = new TestSuite();
+ 
+     // run as embedded
+     suite.addTest(baseSuite());
+ 
+     // run as client server
+     suite.addTest(TestConfiguration.clientServerDecorator(baseSuite());
+ 
+     return new CleanDatabaseTestSetup(suite);
+ }
+ private Test baseSuite() {
+     TestSuite suite = new TestSuite(MyTest.class)
+     if (JDBC.vmSupportsJDBC3()) {
+           suite.addTest("jdbc3SomeTestCase");
+     }
+     return suite;
+ }
+ }}}
+ 
  
  === All test fixtures running only as embedded ===
+ <!> Note this setup does '''not''' include a !CleanDatabaseTestSetup.
  {{{
  public Test suite() {
     return TestConfiguration.embeddedSuite(MyTest.class);
@@ -41, +68 @@

  }}}
  
  === All test fixtures running only as client ===
+ <!> Note this setup does '''not''' include a !CleanDatabaseTestSetup.
  {{{
  public Test suite() {
     return TestConfiguration.clientServerSuite(MyTest.class);
  }
- }}}
+ }}} 
  
  == Suites ==
  

Mime
View raw message