This is why and how we use HSQL for testing.

- It is much faster for developers who are in the habit of continuous testing 
to use HSQL instead of (for example) Oracle.
- We don't have enough Oracle resources (connections, accounts, cpu) to support 
all the developers using it for continuous testing.
- When running inside a debugger (like Eclipse or IntelliJ's), you can step 
down all the way into the database to see exactly what the sql is doing.

- HSQL is only used for developer testing.  Cruisecontrol and Maven and QA and 
everything else use both Oracle and SqlServer.
- The driver, uri, username, and password are all in configuration files, so 
the same TestSetup is used for all databases.
- The differences in the databases can be solved the same way as you would 
solve compatibility issues between Oracle and SqlServer.

So developing against HSQL and going live against Oracle could have some 
issues, all problems should be found and fixed by always running against Oracle 
with infrastructure tools and in QA.



On Wednesday 05 January 2005 04:54 pm, Janos Mucsi wrote:
> 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]
> 
> 

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

Reply via email to