It happens very often that MockMvc is used in heavyweight integration tests. It's no use to waste time to check if another condition has been fixed or not. Soft assertion could help a lot to check all conditions at once even if one of them fail.

Comment From: sbrannen

  • Related to #20963

Comment From: wyhasany

@nguyensach I've applied your suggestions. Do you need any action on my side?

Comment From: sbrannen

Current work on this issue can be seen in the following feature branch: https://github.com/spring-projects/spring-framework/compare/main...sbrannen:issues/gh-26917-MockMvc-soft-assertions

Comment From: sbrannen

Thanks for the PR, @wyhasany! 👍

This has been merged into main in 35bec8102b014feac18c5b096b39c3592c27b76e, refined in 5f47d3be227e115c57b03e73f5df97993c44fdd8 and cd078eaad83e2c6cb441719086b460e665c20f35, and then fully revised in dd9b99e13d6b30462fb168799e6bbca1456123da.

In the end we decided to introduce a new andExpectAll() method in ResultActions and to move away from static methods in ResultMatcher. In fact, we even deprecated the existing matchAll() method in ResultMatcher.