Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.2 web async test Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.2 web async test

    I had spent a couple of days to try Spring 3.2 new mvc test feature for testing async request by asyncDispatch and some situation disturb me.(execute attachment by "mvn test" and look at the testing log).

    My problems are
    1. Only a few method success, but most of them failed
    2. Sometimes async request method was invoked twice

    Finally,I wrote another test method "testMultipleAsyncEcho2" to complete the test.

    Is there a official,robust way to test async request ?
    Last edited by kent.yeh; Dec 20th, 2012, 04:04 AM. Reason: modify attachment

  • #2
    I suspect error prone due to testng dataprovider running on different thread.

    So I modify attachment and add a multiple threads testing and same problem occurs.

    I think may be Mvc fluent testing can not be applied to multiple threads environment.

    Comment


    • #3
      PathVariable at final problem

      I found another problem.

      Running attachment by execute "mvn jetty:run" command to run and go to http://localhost:8080/echo/.

      Every thing is OK except type "Photo's name is Picture.jpg" in the second input field and click on the second Async button.
      It raise a http 406 HttpMediaTypeNotAcceptableException.

      That is because message embed in the final path(a PathVariable).
      and 3.2 document says content type determines by file extension.

      I had been writing a picture management system and always make picture's file name as final patch variable.
      How can I change configuration to backwards to pre spring version?

      Comment


      • #4
        This problem(PathVariable at final problem) had solved, see another thread discussion.

        Comment


        • #5
          Solved! Spring 3.2 web test cannot running under multiple thread

          The MockMvc.java snip to display not thread safe.
          Code:
          public ResultActions perform(RequestBuilder requestBuilder) throws Exception {
              ....
              this.filterChain.reset();
              this.filterChain.doFilter(request, response);
          
              applyDefaultResultActions(mvcResult);
              ....
          }
          So I rewrite some code to solve this problem
          Last edited by kent.yeh; Jan 31st, 2013, 01:35 AM.

          Comment

          Working...
          X