We use the transaction tests Maven / Surefire and Spring / Hibernate for a fairly large web application. In total, there are 138 Test * classes in which 1,178 tests are performed.
mvn test generate 82 errors, the nature of which implies damage to the application context:
Many of them:
IllegalTransactionStateException: Pre-bound JDBC Connection found!
Here is some of them:
NoSuchMethodError: org.hibernate.cache.CacheException.<init>(Ljava/lang/Exception;)V
For each failed test, execution of the test class individually mvn test -Dtest=TestFailingClass succeeds. Indeed, using - Dtest=TestClass1,TestClass2,Etc with various subsets of all my test classes successfully or unsuccessfully in different ways. For example, running only failed test classes fails with 0 errors.
With no obvious means to control the order of classes tested by Surefire, it's hard for me to determine which of my test classes seem to leave the context in poor condition.
What I'm looking for is a strategy to help determine what is going on in some deterministic way. Of course, I can see the order in which tests are run from the log, but I cannot reproduce this order in a controlled way.
And of course, suggestions on what to do about it ...
source share