Testing Render Request; doView, doEdit, doHelp and render methods
=============================================
There is a class, RenderTestHarness, that will allow you to test your
render, doView, doEdit and doHelp methods, as long as they do not use the
PortletRequestDispatcher. That is, you cannot include a jsp file when using
RenderTestHarness. If you want to include a JSP, use PortletRunner instead.
Example testing a ConstantPortlet. The test dumps the output from the
portlet.
public void testDoView() throws Exception{
Portlet portlet = new ConstantPortlet();
RenderTestHarness harness = new RenderTestHarness(portlet);
harness.runDoView();
System.out.println(harness.getOutput());
}
There is a ProcessActionTestHarness that works in a similar way.
--
I am, truly and sincerely,
your friend and well-wisher,
m0smith
http://www.ferociousflirting.com
|