Thursday, August 9, 2007

SpringFramework Nugget...

Recently we were dealing with an issue in a Spring based application that was causing us some real problems. We had an integration test that we were using to perform some black box testing. Unfortunately, we were getting test failures because the unexpected state of the springletons (not true singletons, but through the use of spring, they act as singletons). When running a subset of our tests individually, they had no problem. However, when ran in a suite, those same tests that succeeded on their own, now failed.

After some digging, we found that a test that was running earlier was putting the springletons, in an unexpected state, affecting the remaining tests. In order to resolve this issue, we used the setDirty() (See section 8.3.1) on our integration tests to make sure that Spring would reload the objects anew.

I hope this little nugget of information helps someone else out there...

No comments: