Suran Jayathilaka wrote:
Hi,
I'm currently working on converting the test store/streamingColumn to JUnit.
One problem I am facing is as follows.
The many test methods in this class have create table statements,
mostly with the same table name "foo".
A best practice is to move the create statements to the
CleanDatabaseTestSetup.decorateSQL() method in baseSuite(). But in
this case, that'll mean more than 20 unnecessary tables that get
created and dropped for each and every fixture, as according to my
understanding, the decorateSQL() method is run before each fixture.
decorateSQL is run only once per class. (setup runs once per fixture)
Is this sort of behavior acceptable in the context of this testcase?
Or is there a better way to have only the table required for a
specific fixture be created, while retaining the automatic cleanup
provided by the decorateSQL() method?
I think it is fine to have the 20 tables created in decorateSQL. The
other alternative might be to create the table as part of the fixture
itself, but then if you use the same name as is done in the current
test, one failure might lead to cascading failures, so I would vote for
keeping the create tables in decorateSQL.
Kathey