Hi guys,
I'd like to add the junit-addons dependency to server-integ and add
the MultiThreadedMultiInvoker Rule from there to some tests.
The MultiThreadedMultiInvoker (MTMI) [1] is am implementation of
JUnit's MethodRule. If it is defined in a test class like this
@Rule
public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker();
the invocation of each test method is intercepted by the rule. In case
of the MTMI class the test method (including setups and teardowns) are
invoked multiple times and optionally in multiple threads.
By default, when running the tests with "mvn test" or from within
Eclipse each test method is invoked only once, so there is no
difference to the current situation. But it is possible to control the
number of threads and invocations per thread via system properties:
-Dmtmi.invocations=100
-Dmtmi.threads=10
-Dmtmi.trace=true
It helped me to find some issues with unclosed resources in
integration tests, and especially a problem in StartTlsIT test that
caused hanging tests on Windows, so I think it is quite useful.
Kind Regards,
Stefan
[1]
http://svn.apache.org/viewvc/directory/buildtools/trunk/junit-addons/src/main/java/org/apache/directory/junit/tools/MultiThreadedMultiInvoker.java?view=markup