Schaible, J�rg wrote:
Hi folks,what is the best strategy to have unit tests for Fortress components? My first approach was to run through the lifecycle, but I need a lot of mock objects: public void testComponent() throws Exception { try { ServletContainer lContainer = new ServletContainer(); // Initialization phase ContainerUtil.enableLogging(lContainer, new NullLogger()); ContainerUtil.contextualize(lContainer, m_Context); ContainerUtil.service(lContainer, new DefaultServiceManager()); ContainerUtil.configure(lContainer, new DefaultConfiguration("test")); ContainerUtil.initialize(lContainer); ContainerUtil.start(lContainer); // Destruction phase ContainerUtil.stop(lContainer); ContainerUtil.dispose(lContainer); } catch (ContextException e) { fail("Container contextualization."); } catch (ServiceException e) { fail("Container service."); } catch (ConfigurationException e) { fail("Container configuration."); } } Test fails at the DefaultServiceManager, since it is not properly initialized. So what do you do testing your components?
All ECM components are pretty much compatible with Fortress. We wrote the TestCase subproject to handle all of that for us. It can easily be altered to work with Fortress instead of ECM. It is what we eventually want to do--but our hands are tied until Fortress is officially released. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
