You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Andreas Korneliussen <An...@Sun.COM> on 2006/08/16 13:48:43 UTC
[junit] _app.properties replacement mechanism for JUnit tests
I am about to enable more testcases in ConcurrencyTest, which relies on
getting a lock timeout to verify a lock conflict. The problem is that
default setting for lock timeout is 60 seconds, and the test uses a lot
of time waiting for the timeout. I can make the test go 10 times faster
by reducing derby.locks.waitTimeout (and with all testcases enabled it
used 350 secs in embedded framework).
With the current harness, I could add a ConcurrencyTest_app.properties
file and set it there. However this test is now part of _Suite (a pure
junit Suite).
One quick-fix for me would be to create a _Suite_app.properties. This
would cause all junit tests in the suite to run with the same
properties. Another quick-fix would be to remove it from the _Suite, and
put it into the "old-harness" suites.
- However, if the Derby community is interested at completely replacing
the old test harness in the future, it would be good to have a pure
junit solution to this.
One solution could be to create a TestSetup, which can configure the
database for a junit Test, and delete the database once the test is
complete - i.e
public class DBSetup extends BaseJDBCTestSetup
{
public void setUp() { create and configure db }
public void tearDown() { delete db }
}
Other thoughts ?
-- Andreas
Re: [junit] _app.properties replacement mechanism for JUnit
tests
Posted by Daniel John Debrunner <dj...@apache.org>.
Andreas Korneliussen wrote:
> I am about to enable more testcases in ConcurrencyTest, which relies on
> getting a lock timeout to verify a lock conflict. The problem is that
> default setting for lock timeout is 60 seconds, and the test uses a lot
> of time waiting for the timeout. I can make the test go 10 times faster
> by reducing derby.locks.waitTimeout (and with all testcases enabled it
> used 350 secs in embedded framework).
>
> With the current harness, I could add a ConcurrencyTest_app.properties
> file and set it there. However this test is now part of _Suite (a pure
> junit Suite).
>
> One quick-fix for me would be to create a _Suite_app.properties. This
> would cause all junit tests in the suite to run with the same
> properties. Another quick-fix would be to remove it from the _Suite, and
> put it into the "old-harness" suites.
>
> - However, if the Derby community is interested at completely replacing
> the old test harness in the future, it would be good to have a pure
> junit solution to this.
>
> One solution could be to create a TestSetup, which can configure the
> database for a junit Test, and delete the database once the test is
> complete - i.e
>
> public class DBSetup extends BaseJDBCTestSetup
> {
> public void setUp() { create and configure db }
> public void tearDown() { delete db }
> }
>
>
> Other thoughts ?
Take a look at:
http://wiki.apache.org/db-derby/KillDerbyTestHarness
A test setup exists to set system properties, a test setup exists to
clean a database.
Dan.