Bryan Pendleton wrote:
I thinking about automating the close on tearDown() in BaseJDBCTestCase for any statement opened via any utility method, such as createStatement(), prepareStatement(), prepareCall() etc.

The goal of this is to avoid application-level leaks when many tests are run?

Could be one reason.

I see a few benefits:

- A test would be more likely to perform complete cleanup. This reduces the risk of cross-fixture contamination (open objects in one fixture causing issues for other fixtures).

- It also could save developer time by not having to investigate other fixtures when one fails. E.g. if I see a unexpected result set open exception in a fixture and saw that three other fixtures didn't close their JDBC objects I would spend time cleaning up those tests to ensure that they were not interfering. Automatic cleanup would ensure I would have to spend minimal amount of time cleaning up other tests before looking at the actual problem.

- Maybe minor, but it would reduce the amount of code in a test fixture, this allowing the reader to focus on the actual test cases. That's really what the utility methods are for.

Dan.

Reply via email to