But this means your live system also has to run using
HSQL otherwise this test does not make sense right?
(Because of the differences in the SQL dialects, for
example.)

>I set up the HSQL database in the JUnit TestSetup. 
This drops and 
re-creates the database for each test class that need
the database, but 
the overhead is quite low, only a few test classes
need the database 
running, and it ensures left over database artifacts
will not have any 
side-effects on future tests.  Only starting the
database and creating the 
tables once for all tests can be easily accomplished
by keeping around 
the static connection and have all test classes get
that connection 
instead of doing the setup themselves.
>
>The code looks something like this:
>
>public class JDBCTest extends TestCase {
>  private static Connection conn;
>
>  public static Test suite() {
>    TestSuite suite = new TestSuite(JDBCTest.class);
>
>    TestSetup wrapper = new TestSetup(suite) {
>      protected void setUp()
>        throws Exception {
>        Class.forName("org.hsqldb.jdbcDriver");
>        conn =
DriverManager.getConnection("jdbc:hsqldb:.", "sa",
"");
>        // LOAD SCHEMA HERE
>      }
>      protected void tearDown()
>        throws Exception {
>          conn.close();
>      }
>    };
>    return wrapper;
>  }
>
>  public void testSomething() {
>  }
>}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to