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 "KillDerbyTestHarness" by DanDebrunner
Date Sun, 29 Oct 2006 01:29:11 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/KillDerbyTestHarness

------------------------------------------------------------------------------
     * Standard mechanism to add suites (use of !TestSuite class directly)
   * Tests can be run from an ant target
   * Tests/Suites can be added into other project's test suites with no additional knowledge
or requirements
+ 
+ == Conversion or writing JUnit tests FAQ ==
+ === Decorators ===
+ A number of useful decorators and convenience methods that return decorators exist, this
section shows which to use for certain situations.
+ Remember that a decorator can wrap a set of test fixtures:
+ {{{
+   return new CleanDatabaseTestSetup(suite);
+ }}}
+ or a single test fixture
+ {{{
+  suite.addTest(new CleanDatabaseTestSetup(new MyJDBCTest("testJDBCStuff")));
+ }}}
+ Decorators can also be nested, some thought may be required to ensure the nesting results
in the correct execution order:
+ {{{
+   return new CleanDatabaseTestSetup(
+              DatabasePropertyTestSetup.setLockTimeouts(suite, 2, 4));
+ }}}
+ 
+ || '''Question''' || '''Answer''' ||
+ || How to set system properties for a test? || Setting properties on a database level is
preferred as setting properties at a system level may interfere with other tests that could
be run in parallel. However the !SystemPropertyTestSetup decorator does exist to allow setting
system properties, passing in the set of properties to set. ||
+ || How to set database properties for a test? || Use the !DatabasePropertyTestSetup decorator
passing in the set of properties to set. ||
+ || How to reduce the lock timeout values for a test? || Use the conveniencedecorator returned
by !DatabasePropertyTestSetup.setLockTimeouts or !DatabasePropertyTestSetup directly. ||
+ || How to set BUILTIN authentication with a set of users || Use the convenience decorator
returned by !DatabasePropertyTestSetup.builtinAuthentication, use a unique password token
||
+ || How to run as a different user? || Use the decorator returned by !TestConfiguration.changeUserDecorator
||
+ || How to run tests with Derby's client driver? || Any test class's suite() method should
return a suite that runs fixtures in embedded and client/server mode as required. !TestConfiguration.defaultSuite()
takes a Class object and returns a suite that runs all the test methods starting with `test`
in both embedded and client server. When more control is needed over wich tests are run in
emebdded and client/server !TestConfiguration provides these methods: clientServerDecorator,
clientServerSuite & embeddedSuite. In addition the !NetworkServerTestSetup decorator can
be used directly. ||
+ || Since the database is re-used when running tests how do I ensure the test starts out
with a clean database? || Use the !CleanDatabaseTestSetup decorator. ||
+ || How to execute DDL at setUp that is dropped automatically at tearDown? || Provide a class
that extends !CleanDatabaseTestSetup and implement the decorateSQL method. This can be achieved
as an inner class, search for references to !CleanDatabaseTestSetup for examples. ||
+ 
  
  == Harness features ==
  

Mime
View raw message