db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: JUnit problem
Date Tue, 04 Dec 2007 20:13:00 GMT
Dyre.Tjeldvoll@Sun.COM writes:

> Hi,
>
> I'm trying to create some test cases that only will be run when using
> DerbyNetClient. This is what I do:
>
>     private static Test baseSuite(String name) {
>         TestSuite suite = new TestSuite(name);
>
>         suite.addTestSuite(StatementJdbc30Test.class);
>
>         if  (usingDerbyNetClient()) {
>             // These test CAN be run in embedded mode as well, but
>             // they're only meaningful in c/s mode and also take quite
>             // a bit of time to run.
>             suite.addTest(new StatementJdbc30Test
>                           ("xtestMultiExecWithQueryTimeout"));
>             suite.addTest(new StatementJdbc30Test
>                           ("xtestMaxOpenStatementsWithQueryTimeout"));
>         }
>
>         return new CleanDatabaseTestSetup(suite) { 
>
> ...
>
> But when I run StatementJdbc30Test I don't see the x-test cases being
> run. If comment out  "if  (usingDerbyNetClient()) {" the testcases run just
> fine (in both frameworks), so it would seem that the predicate is not
> doing what I expect. Does anyone know what I'm missing here?

usingDerbyNetClient() only works when the test is running. When you're
in the suite() method, you always have the default TestConfiguration.

You could try something like this instead:

    TestSuite clientSuite = new TestSuite(name + " - client only");
    clientSuite.addTest(new StatementJdbc30Test
                        ("xtestMultiExecWithQueryTimeout"));
    clientSuite.addTest(new StatementJdbc30Test
                        ("xtestMaxOpenStatementsWithQueryTimeout"));

    suite.addTest(TestConfiguration.clientServerSuite(clientSuite));

-- 
Knut Anders

Mime
View raw message