[MAGNOLIA-5173] Deprecate/rewrite MgnlTestCase and subclasses - Testing framework issues Created: 10/Jul/13  Updated: 19/May/22  Resolved: 19/May/22

Status: Closed
Project: Magnolia
Component/s: core, testing
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Magnolia International Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: next
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
supersession
supersedes MAGNOLIA-5170 LegacyComponentsConfigurer can't work... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

When working on WorkflowJBPMModuleVersionHandlerTestCase, I noticed a few weird behaviors. See MAGNOLIA-5170.

Some more "interesting" observations that may or may not be related, but are probably due to other bugs in MgnlTestCase, RepositoryTestCase etc:

  • In my test, only the 2nd test method would fail, from the setUp, due to the imaging component being registered twice. Consequently, the tearDown would also fail, claiming a SystemContext impl isn't registered (which is what led me to the 2nd workaround)
  • When adding the following in my test class, both test methods would fail the same way, which leads me to believe there are other bugs in the setup/teardown of our abstract test classes.
        @Override
        @Before
        public void setUp() throws Exception {
            SystemProperty.clear();
            ComponentsTestUtil.clear();
            super.setUp();
        }
    
  • When running through the various setUp() methods (MgnlTestCase, RepositoryTestCase, ModuleVersionHandlerTestCase, I noticed that info.magnolia.cms.core.SystemProperty#magnoliaConfigurationProperties was swapped a number of times, making it hard to reliably know what properties are currently configured.

In general, I'm not sure we should even try to fix this, because it's really all using legacy code. The abstract/parent test clases are of course still useful, to provide Magnolia-specific helpers, or setup a repository, but they could be simplified by properly making use of IoC (i.e by not relying on properties and configured singletons, but by manually assembling the components it needs). This would impact the production code as well as the test framework.

Things like LegacyComponentProvider should probably not be used in newer tests, but they still do, because we tend to keep on using the same patterns as we used in the days of MgnlTestCase.



 Comments   
Comment by Roman Kovařík [ 19/May/22 ]

Hello,

This ticket is now marked as closed due to one of the following reasons:

  • A long period of inactivity
  • Uses an old or Beta version of an application, module, or framework that we no longer support
  • The issue is no longer reproducible or has been fixed in later versions

If you are still facing a problem or consider this issue still relevant, please feel free to re-open the ticket and we will reach out to you.

Thank you,
The Magnolia Team

Generated at Mon Feb 12 04:02:40 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.