You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2011/05/23 17:16:34 UTC

Unit tests conversion is done

Between myself and Dzmitry Kazimirchyk we just finished a huge project of converting our unit tests to the DI container. We have a much cleaner test system as a result:

* No more verbose XML files for data sets.
* No more Spring XML configuration.
* Injection into test cases of pretty much anything. This means much less bloat in the tests, so the actual assertions are easy to see and understand.
* Real inversion of control - now it is possible to build test classes (or common superclasses) based on a very specific DI configuration. For now we have 2 such configs - ClientCaseModule and ServerCaseModule plus a few adhoc ones.
* DI container provides correct resource scoping. The only thing in the global scope is DB schema drop/create. The rest (including instantiation of Cayenne stacks) is in per-test-method scope. This means that tests can freely alter DataMaps, etc. without having to worry about resetting them back.

I may still do some refactoring of the DI code, but the main thing is there. 

Andrus