db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oliver.m...@ppi.de
Subject RE: SQL statement counts in junit tests, was: RE: Performance dec reas e of ODMG-api in CVS
Date Tue, 07 Oct 2003 10:03:24 GMT

> -----Original Message-----
> From: oliver.matz@ppi.de [mailto:oliver.matz@ppi.de]

> as proposed earlier, I have written a sample test that
> does some API calls, counts the generated SQL statements,
> and complains in case the number is not as expected.
> Such tests could prevent us from unintentionally 
> increasing that number.
> Issues: the test requires either modifications to 
> the existing spy.properties or a separate 
> testsuite-spy.properties file. (We have to use 
> an special appender). 
> In the first case, non-aware users might try to
> ship that file unintentionally and get failures.
> In the second case, I would have to modify
> AllTests.suite.

I have committed the p6spy CountLogger and an example
test SimpleCountTest that shows how to use it.  
I will soon add an ant target to start the test.
As you can see, any test that whishes to count 
statements should inherit from AbstractCountTest.
The test will fail with a suitable error message
if p6spy is not enabled, or if the number 
of SQL statements is higher or lower than expected.
In the latter case, the developer should verify
that he or she has not made a mistake but a 
performance improvement, and then adapt the 
expected statement number.

The tests requires a specific testsuite-spy.properties,
which has to be set BEFORE the first test in the test-suite.
Currently, this is done in AbstractCountTest.setup().

Question 1:  should there be another 
class similar to AllTests, say AllCountTests,
or shall all old tests also use that 

Question 2: Should we adapt the junit task in such a way
that useP6Spy is always assumed for junit?


To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message