JUnit 5 interview questions — Medium
201 medium-level JUnit 5 questions from our Automation Testing bank, each with the correct answer and an explanation of why it is correct.
What this covers
JUnit 5 appears throughout Automation Testing interviews. At medium level, interviewers are typically checking that you have used it in practice: what you configured, what broke, and how you knew it worked. Work through these, then explain your answer out loud; the second part is what interviews actually test.
1 example questions
1. Which JUnit 5 annotation runs the same test repeatedly with different argument sets?
- A. @RepeatedTest.
- B. @ParameterizedTest with a source (e.g., @ValueSource).correct
- C. @BeforeEach.
- D. @Disabled.
Why: @ParameterizedTest combined with a source (@ValueSource, @CsvSource, @MethodSource, …) runs the test once per provided argument set.