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 "DerbyJUnitTesting" by DanDebrunner
Date Thu, 31 Aug 2006 16:55: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/DerbyJUnitTesting

------------------------------------------------------------------------------
  === Running tests using Junit directly ===
  
  Tests can be run using the Junit 3.8 !TestRunners. The classpath needs to include the junit.jar
and the Derby classes.
+ Most of Derby's JUnit test cases and suites run successfully using the !TestRunners directly,
as that is the eventual goal.
+ Hopefully all new test
  
- /!\ Since running a test like this is (currently) outside of the Derby test harness, setup
the test expects may not be provided and thus the
- test may change its behaviour in unpredictable ways.
- One aspect of this is that the junit TestRunners do not automatically start with securityManager,
so you need to add that yourself, using -Djava.security.manager -Djava.security.policy=<policyfile>.
+ The class name of the test passed to the runners can be an individual test case or one one
of the Derby suites, see examples.
+ 
+ /!\ Some JUnit tests may require running in the old harness for two reasons:
+    * they depend on harness functionality that has not be added to the JUnit utility classes
or 
+    * no-one has converted the test to use the new utiltiy methods
+ Such tests may fail in unpredictable ways when run by !TestRunners direcly. One way to identify
such tests is to see
+ if they have any _app.properties or _derby.properties file, or they are listed in exclude
files.
+ 
+ <!> The only current (hopefully short lived) requirement for running tests using !TestRunners
directly is that the system 
+ property `derby.system.home` is set to the current directory. No other properties are required,
the BaseTestCase class
+ automatically installs a security manager with the correct policy file.
  
  ==== batch run ====
  {{{
+ # Single test case
- > java -cp '../../tools/java/junit.jar;../../classes' junit.textui.TestRunner
+ > java -Dderby.system.home=$PWD -cp '../../tools/java/junit.jar:../../classes' junit.textui.TestRunner
          org.apache.derbyTesting.functionTests.tests.jdbcapi.ProcedureTest
  ...........................
  Time: 8.943
  
  OK (27 tests)
- >
+ 
+ # The jdbcapi package _Suite
+ java -Dderby.system.home=$PWD junit.textui.TestRunner org.apache.derbyTesting.functionTests.tests.jdbcapi._Suite
+ 
+ # All the embedded cases
+ java -Dderby.system.home=$PWD junit.textui.TestRunner org.apache.derbyTesting.functionTests.tests.suites.Embedded
+ 
  }}}
  ==== GUI (awt) run ====
  {{{
- > java -cp '../../tools/java/junit.jar;../../classes' junit.awtui.TestRunner
+ > java -Dderby.system.home=$PWD -cp '../../tools/java/junit.jar;../../classes' junit.awtui.TestRunner
  }}}
  The supply the complete name of the test class in the top window, e.g. `org.apache.derbyTesting.functionTests.tests.jdbcapi.ProcedureTest`.
  

Mime
View raw message