[jboss-dev-forums] [QA of JBoss Portal] - Portlet Container test framework update

julien@jboss.com do-not-reply at jboss.com
Wed Oct 24 06:06:21 EDT 2007


It is about migrating the portlet container test framework in order to take advantage of Java 5 and make the different tests easier to write (as we plan to add lot of new tests for the JSR 286 implementation). It will only leverage for now annotations which are helpful to describe the sequence of the different methods composing a test case.

Now we have something like

package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
  | 
  | public class PortletInterfaceSequenceBuilder extends PortletTestSuite
  | {
  |    /**
  |     * @portlet.specification assert="SPEC:4 - After the portlet object is instantiated, the portlet container must
  |     * initialize the portlet before invoking it to handle requests"
  |     */
  |    public void createInitializeBeforeHandleCase(PortletTestDriver registry)
  |    {
  |       PortletTest seq = new PortletTest();
  |       registry.addSequence("InitializeBeforeHandle", seq);
  |       seq.addAction(0, InitializeBeforeHandlePortlet.RENDER_JOINPOINT, new PortletRenderTestAction()
  |       {
  |          protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
  |          {
  |             assertTrue(InitializeBeforeHandlePortlet.init);
  |             return new EndTestResponse();
  |          }
  |       });
  |    }
  | }

Each test case should be migrated to a single class which will help to isolate the test cases from each other and will be constitued of methods annotated with @JoinPoint annotation describing when and where this methods should be executed during a portal request. There will be also the @TCK annotation that will be optional and will annotate methods that test TCK assertions present in the spec.

package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
  | 
  | public class InitializeBeforeHandle
  | {
  |    @TCK(4)
  |    @JoinPoint(count = 0, portletId = InitializeBeforeHandlePortlet.NAME)
  |    public DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
  |    {
  |       assertTrue(InitializeBeforeHandlePortlet.init);
  |       return new EndTestResponse();
  |    }
  | }



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4098218#4098218

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4098218



More information about the jboss-dev-forums mailing list