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 KristianWaagan
Date Thu, 25 May 2006 23:31:17 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 KristianWaagan:
http://wiki.apache.org/db-derby/DerbyJUnitTesting

------------------------------------------------------------------------------
  
  By default, all test methods whose name starts with `test` are added to the suite, typically
with `new TestSuite(MyDerbyTests.class, "My suite name")`. If there are tests that should
only be run in certain scenarioes, logic for doing this should be placed in `suite()`. The
prominent example is a test method that is only to be run in the !DerbyNetClient framework.
To fix this, name the method for instance `clientSomeTest` and add it manually to the suite
if `BaseJDBCTestCase.usingDerbyNetClient()` returns true with `suite.addTest(new MyDerbyTests("clientSomeTest"))`.
In general, all tests should be written to be able to run under any framework, and tests written
for a specific framework should be placed in a separate test class. When it is run should
be controlled by the mechanisms provided by the test harness (exclude/skip files).
  
+ === Usage of SQL states in JUnit tests ===
+ In your tests, you might want to check for a specific SQL state when an SQLException is
thrown. The recommended way to handle this, is to use the `BaseJDBCTestCase.assertSQLState(String,String,SQLException)`
and either pass in a constant from `org.apache.derby.functionTesting.util.SQLStateConstants`,
or simply hardcode the value or use your own test-local constant. Doing this will assure tests
break if someone changes the SQL state for an exception in the internal class, and raises
the awareness of SQL state changes in the community.
+ 
+ Please do not reference the internal Derby class that define SQL states. This class is not
part of Derby's public interface, and should thus not be used to check for expected SQL states.
+ 
  == Requested features for the JUnit harness ==
  Features requested for the JUnit harness on derby-dev. Note that this page is intended to
be a summary page only. In general, all information presented here should be found in the
mail archives for derby-dev as well (you can search here: http://www.nabble.com/Derby-f356.html).
  

Mime
View raw message