![]() |
|
|
Change By:
|
Grégory Joseph
(10/Jul/13 12:28 PM)
|
Summary:
|
Deprecate/rewrite MgnlTestCase and subclasses -
Testing framework issues
|
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. {code} @Override @Before public void setUp() throws Exception { SystemProperty.clear(); ComponentsTestUtil.clear(); super.setUp(); } {code} * 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}}.
|
|
|
|
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------