Is there any way with Maven to run a piece of code as setup before testing each module? Cleanup for each module as well would be a plus.
To give an example, let's say I have modules A and B, with test classes AA, AB, BA, BB and BC, each of which containing a couple of test method. So module A would run the test classes AA and AB, the first containing the test methods AA.1 and AA.2 and the second AB.1 and AB.2.
Given that, I'd like test setups run like this:
- Before module A
- Before class AA
- Before method AA.1
- Before method AA.2
- Before class AB
- Before method AB.1
- Before method AB.2
- Before module B
- Before class BA
- and so forth
It's easy to setup most of this, but I see no way to perform steps 1 and 8, and I'd like to.
EDIT
Yeah, this is the kind of thing that ought to be integration testing, but it isn't, and we are talking about dozens of modules, let alone tests. I need to prepare these resources per-module mostly so the module testing can be made to run in parallel.