Skip to content
Sharp

Testing · interview question

Why do teams use @WebMvcTest in a Spring Boot application in production code?

Multiple choiceEasychapter-10-curatedpremiumtestingcontroller-testing
Choose one answer
Answer and explanation

Correct answer

D. To test only the web layer components like controllers

Why

@WebMvcTest is a specialized test annotation in Spring Boot that is used to test only the web layer, particularly the controllers, without loading the entire application context.

Test yourself on Testing

A free test with instant, explained results. No account needed.

Start free test
All Testing questions →