JUnit 5 interview questions — Easy

98 easy-level JUnit 5 questions from our Automation Testing bank, each with the correct answer and an explanation of why it is correct.

This topic slice is available to practise but is not yet part of our indexed set.

What this covers

JUnit 5 appears throughout Automation Testing interviews. At easy level, interviewers are typically checking that you know the fundamentals and can describe them precisely — definitions, defaults, and the basic mechanics. Work through these, then explain your answer out loud; the second part is what interviews actually test.

20 example questions

  1. 1. In the context of JUnit, assertAll is best described as:

    • A. Groups assertions so all are evaluated and failures reported together.correct
    • B. Marks a Jupiter test method.
    • C. Skips a test or class with an optional reason.
    • D. Supplies inline CSV rows to a parameterized test.

    Why: assertAll: Groups assertions so all are evaluated and failures reported together.

  2. 2. What is the purpose of @CsvSource in JUnit?

    • A. Groups assertions so all are evaluated and failures reported together.
    • B. Marks a Jupiter test method.
    • C. Supplies inline CSV rows to a parameterized test.correct
    • D. Skips a test or class with an optional reason.

    Why: @CsvSource: Supplies inline CSV rows to a parameterized test.

  3. 3. Which of the following best describes @CsvSource in JUnit?

    • A. Runs a test a fixed number of times.
    • B. Injected object describing the current test.
    • C. Supplies inline CSV rows to a parameterized test.correct
    • D. Marks a Jupiter test method.

    Why: @CsvSource: Supplies inline CSV rows to a parameterized test.

  4. 4. In JUnit, what does assertAll do or refer to?

    • A. Injected object describing the current test.
    • B. Supplies inline CSV rows to a parameterized test.
    • C. Runs a test a fixed number of times.
    • D. Groups assertions so all are evaluated and failures reported together.correct

    Why: assertAll: Groups assertions so all are evaluated and failures reported together.

  5. 5. Which of the following best describes @RepeatedTest in JUnit?

    • A. Fails a test exceeding a time limit.
    • B. Groups assertions so all are evaluated and failures reported together.
    • C. Registers extensions such as MockitoExtension.
    • D. Runs a test a fixed number of times.correct

    Why: @RepeatedTest: Runs a test a fixed number of times.

  6. 6. In JUnit, what does @CsvSource do or refer to?

    • A. Fails a test exceeding a time limit.
    • B. Runs a test a fixed number of times.
    • C. Injected object describing the current test.
    • D. Supplies inline CSV rows to a parameterized test.correct

    Why: @CsvSource: Supplies inline CSV rows to a parameterized test.

  7. 7. Which of the following best describes assertAll in JUnit?

    • A. Runs a test a fixed number of times.
    • B. Skips a test or class with an optional reason.
    • C. Marks a Jupiter test method.
    • D. Groups assertions so all are evaluated and failures reported together.correct

    Why: assertAll: Groups assertions so all are evaluated and failures reported together.

  8. 8. What is the purpose of @RepeatedTest in JUnit?

    • A. Runs a test a fixed number of times.correct
    • B. Fails a test exceeding a time limit.
    • C. Skips a test or class with an optional reason.
    • D. Groups assertions so all are evaluated and failures reported together.

    Why: @RepeatedTest: Runs a test a fixed number of times.

  9. 9. In JUnit, what does @ExtendWith do or refer to?

    • A. Fails a test exceeding a time limit.
    • B. Groups assertions so all are evaluated and failures reported together.
    • C. Registers extensions such as MockitoExtension.correct
    • D. Injected object describing the current test.

    Why: @ExtendWith: Registers extensions such as MockitoExtension.

  10. 10. Which of the following best describes @Disabled in JUnit?

    • A. Supplies inline CSV rows to a parameterized test.
    • B. Marks a Jupiter test method.
    • C. Registers extensions such as MockitoExtension.
    • D. Skips a test or class with an optional reason.correct

    Why: @Disabled: Skips a test or class with an optional reason.

  11. 11. What is the purpose of @ExtendWith in JUnit?

    • A. Registers extensions such as MockitoExtension.correct
    • B. Fails a test exceeding a time limit.
    • C. Skips a test or class with an optional reason.
    • D. Supplies inline CSV rows to a parameterized test.

    Why: @ExtendWith: Registers extensions such as MockitoExtension.

  12. 12. Which of the following best describes @ExtendWith in JUnit?

    • A. Groups assertions so all are evaluated and failures reported together.
    • B. Registers extensions such as MockitoExtension.correct
    • C. Fails a test exceeding a time limit.
    • D. Runs a test a fixed number of times.

    Why: @ExtendWith: Registers extensions such as MockitoExtension.

  13. 13. In JUnit, what does @RepeatedTest do or refer to?

    • A. Groups assertions so all are evaluated and failures reported together.
    • B. Runs a test a fixed number of times.correct
    • C. Registers extensions such as MockitoExtension.
    • D. Fails a test exceeding a time limit.

    Why: @RepeatedTest: Runs a test a fixed number of times.

  14. 14. In JUnit, what does TestInfo do or refer to?

    • A. Skips a test or class with an optional reason.
    • B. Runs a test a fixed number of times.
    • C. Groups assertions so all are evaluated and failures reported together.
    • D. Injected object describing the current test.correct

    Why: TestInfo: Injected object describing the current test.

  15. 15. What is the purpose of @Timeout in JUnit?

    • A. Skips a test or class with an optional reason.
    • B. Fails a test exceeding a time limit.correct
    • C. Marks a Jupiter test method.
    • D. Injected object describing the current test.

    Why: @Timeout: Fails a test exceeding a time limit.

  16. 16. Which of the following best describes @Test in JUnit?

    • A. Supplies inline CSV rows to a parameterized test.
    • B. Skips a test or class with an optional reason.
    • C. Marks a Jupiter test method.correct
    • D. Fails a test exceeding a time limit.

    Why: @Test: Marks a Jupiter test method.

  17. 17. In JUnit, what does @Disabled do or refer to?

    • A. Skips a test or class with an optional reason.correct
    • B. Groups assertions so all are evaluated and failures reported together.
    • C. Supplies inline CSV rows to a parameterized test.
    • D. Runs a test a fixed number of times.

    Why: @Disabled: Skips a test or class with an optional reason.

  18. 18. Which of the following best describes @Timeout in JUnit?

    • A. Groups assertions so all are evaluated and failures reported together.
    • B. Fails a test exceeding a time limit.correct
    • C. Marks a Jupiter test method.
    • D. Registers extensions such as MockitoExtension.

    Why: @Timeout: Fails a test exceeding a time limit.

  19. 19. In JUnit, what does @Test do or refer to?

    • A. Groups assertions so all are evaluated and failures reported together.
    • B. Marks a Jupiter test method.correct
    • C. Registers extensions such as MockitoExtension.
    • D. Injected object describing the current test.

    Why: @Test: Marks a Jupiter test method.

  20. 20. Which of the following best describes TestInfo in JUnit?

    • A. Injected object describing the current test.correct
    • B. Registers extensions such as MockitoExtension.
    • C. Fails a test exceeding a time limit.
    • D. Supplies inline CSV rows to a parameterized test.

    Why: TestInfo: Injected object describing the current test.

Related Automation Testing topics