Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 242923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:52:42+00:00 2026-05-11T20:52:42+00:00

I’ve not seen anything in this area I would recommend to a client. If

  • 0

I’ve not seen anything in this area I would recommend to a client. If you’ve used Spring PortletMVC, how did you test it?

It’s easy to test under the level of portlet code, and relatively easy to test on the client side through HtmlUnit, Selenium and the like, but I haven’t seen anything that is a “Gray Box” test in the spirit of JSFUnit (which looks to me to be the way forward).

  • Apache’s Pluto driver could theoretically be used to bootstrap a test harness. Has anyone tried this?
  • Any stub or data provider approaches?
  • Any approach to address two-phase processing concerns?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:52:42+00:00Added an answer on May 11, 2026 at 8:52 pm

    I don’t know anything about portlets but here it goes.

    There’s portletUnit.

    portletUnit is a testing framework
    used to test JSR-168 portlets outside
    portlet container just as servletUnit
    is used to test servlets outside a
    servlet container. The projected is
    architected to map the functionally of
    servletUnit onto portlets with
    servletUnit itself providing the
    foundation for portletUnit.

    Some more related info could be found on his Project PortletUnit blog, including PortletUnit and Spring Portlet: Checking form validation errors.

    When testing with portletUnit, it is
    not obvious how to check if there were
    any form errors. Fortunately, using
    the render listener feature of
    PortletRunner, there is a simple way
    to check for validator errors.

    There’s also a blog article written by Nils-Helge Garli Hegvik in 2007 titled Testing Portlets with Jetty, Pluto and JWebUnit.

    Remembering an excellent article from
    Johannes Brodwall’s blog about
    integration testing with Jetty and
    JWebUnit, I wanted to extend his
    approach to use the embedded
    jetty-pluto setup I have created. This
    turned out to be to be quite easy.

    Finally, Spring Framework documentation 10.2 Unit testing.

    The
    org.springframework.mock.web.portlet
    package contains a set of Portlet API
    mock objects, targeted at usage with
    Spring’s Portlet MVC framework.

    […] The org.springframework.test.web
    package contains ModelAndViewAssert,
    which can be used in combination with
    any testing framework (e.g., JUnit 4+,
    TestNG, etc.) for unit tests dealing
    with Spring MVC ModelAndView objects.

    […] To test your Spring MVC Controllers, use
    ModelAndViewAssert combined with
    MockHttpServletRequest,
    MockHttpSession, etc. from the
    org.springframework.mock.web package.

    Here’s a related article written by John Ferguson Smart titled
    Unit testing your Spring-MVC applications.

    One of the great things about this
    framework is how testable it is. In
    Spring-MVC, any custom validators (for
    field and form validation) and
    property editors (for converting text
    fields to specific Java types) are
    dead-easy to test – you can just test
    them as if they where isolated POJOs.

    Spring-MVC also comes with a full set
    of mock objects that you can use (with
    a bit of practice) to test your
    controllers to your heart’s content.
    For example, you can use classes like
    MockHttpServletRequest and
    MockHttpServletResponse to simulate
    your HTTP request and response
    objects. This is also made easier by
    the fact that Controllers can be
    instanciated as normal Java classes.
    For example, imagine you are testing a
    controller class for a page that
    updates a client details record. You
    could do this very simply as follows:

    public class UpdateClientTest {
            //
            // Prepare your request
            //
            request.setMethod("POST");      
            request.setParameter("id", "100");
            request.setParameter("firstName", "Jane");
            request.setParameter("lastName", "Doe");
            //
            // Invoke the controller
            //
        controller = new ChoosePeriodController();
            ModelAndView mav = controller.handleRequest(request, response);
        //
        // Inject any service objects you need
        //
            controller.setClientService(clientService);
        ...
            //
            // Inspect the results
            //
            assert mav != null;
            assertEquals("displayClient",mav.getViewName());  
            Client client = (Client) mav.getModel().get("client");
            assertEquals("Jane",client.getFirstName());  
            assertEquals("Doe",client.getLastName());  
        ...        
        }
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm looking for suggestions for debugging... If you view this site in Firefox or
I want use html5's new tag to play a wav file (currently only supported
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am currently running into a problem where an element is coming back from
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
In order to apply a triggered animation to all ToolTip s in my app,
I have a JSP page retrieving data and when single or double quotes are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.