@AutoConfigureMockMvc shouldn't default to printing interactions by default
See original GitHub issuePrinting the output every interaction with the preconfigured MockMvc
instances is not a good idea as it pollutes the output in test runs significantly, even if the test succeeds so that logs in CI runs get polluted by all that unnecessary output.
I can certainly see the appeal to default to print when developing test cases, but test cases are hopefully executed way more often in scenarios where nobody is even looking at the output (on the command line, in CI environments).
Of course the default can be tweaked easily bit it feels like there’ll be quite a lot of occasions where @WebMvcTest
is used in combination with @AutoConfigureMockMvc(alwaysPrint = false)
which sort of indicates that that would’ve been the better default.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Spring Boot integration test ignoring secure=false in ...
It says authentication is on, which I do not want. I've set it up with @AutoConfigureMockMvc(secure = false). I submit a mock request...
Read more >Spring Boot Features
By default, INFO logging messages are shown, including some relevant startup details, such as the user that launched the application.
Read more >Java Backend Testing - Broadleaf Dev Central
Because integration tests can take a very long time to run, unit tests should generally be your default choice when writing tests. Use...
Read more >Spring Boot Reference Guide
Using the “default” Package . ... Switch off the Default MVC Configuration . ... Boot provides a way to analyze your application's environment...
Read more >Spring Boot MockMVC Tutorial - Examples Java Code Geeks
Unit tests should not involve any external dependencies directly. ... @WebMvcTest auto-configures the MockMvc object by default.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can now disable printing for all tests by adding an
application.properties
insrc/test/resources
containing:In know, I know. The thing is, that this then still pollutes the output and the stuff I might actually really want to see. I simply think that writing to
Standard.out
behind a user’s back has never been a good idea in the first place.