Announcement Announcement Module
No announcement yet.
Spring 3.2 web async test Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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, 03: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.


    • #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?


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


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

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