Results 1 to 5 of 5

Thread: Spring 3.2 web async test

  1. #1
    Join Date
    Sep 2011
    Posts
    25

    Question Spring 3.2 web async test (multiple thread 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 ?
    Attached Files Attached Files
    Last edited by kent.yeh; Dec 20th, 2012 at 03:04 AM. Reason: modify attachment

  2. #2
    Join Date
    Sep 2011
    Posts
    25

    Default

    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. #3
    Join Date
    Sep 2011
    Posts
    25

    Angry 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. #4
    Join Date
    Sep 2011
    Posts
    25

    Default

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

  5. #5
    Join Date
    Sep 2011
    Posts
    25

    Default 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 at 12:35 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •