Project

General

Profile

Actions

bug #7287

closed

Unit tests using the DefaultTermInitializer break subsequent integration tests in the suite

Added by Andreas Kohlbecker about 6 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
New
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Severity:
normal
Found in Version:
Tags:

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

Related to EDIT - task #7288: Separate Unit and integration tests completely,NewAndreas Müller

Actions
Related to EDIT - bug #8174: First test fails if term data is in loaded DataSetNewAndreas Müller

Actions
Actions

Also available in: Atom PDF