bug #7287
closedUnit tests using the DefaultTermInitializer break subsequent integration tests in the suite
100%
Description
Here we make the distinction between Unit and integration test by the fact that integration tests are sub classing CdmTransactionalIntegrationTest
.
A couple of unit test are making use of term, so the terms need to be initialized. This is done in theses tests by ca method like:
@BeforeClass
public static void setUpBeforeClass() throws Exception {
DefaultTermInitializer initializer = new DefaultTermInitializer();
initializer.initialize();
}
This approach is highly problematic:
If an integration test has run before the TestingTermInitializer
has already initialized the terms. Calling the initialize()
method of the DefaultTermInitializer will reset and override all terms. This breaks subsequent Integration tests since the TestingTermInitializer
is only run once per suite.
An interim solution which is not 100% reliable is to check in the setUpBeforeClass()
method if the terms already have been loaded. This method should be in a base class for all tests that use the DefaultTermInitializer.
As a long term task we should separate Unit and integration tests completely, see #7288
Additional tasks:
- revert
DerivedUnitFacadeCacheStrategyInjectionTest
,DerivedUnitFacadeCacheStrategyTest
,DerivedUnitFacadeFieldUnitCacheStrategyTest
to unit tests, see commented @BeforeClass
Related issues