Skip to content
CodeKruPro

Failures versus errors in the Surefire summary

QuizMediumJava onlyAsked in: Capgemini, Google, Salesforce, TCS, Zupee

A JUnit 5 run ends with:

[ERROR]   LoginTest.invalidPassword:9 expected: <2> but was: <1>
[ERROR]   LoginTest.lockedUser:11 IllegalState boom
[ERROR] Tests run: 3, Failures: 1, Errors: 1, Skipped: 0

Which statement is correct?

  • The failure is an assertion that did not hold (invalidPassword); the error is an unexpected exception thrown by the test (lockedUser)
  • Failures and errors are the same thing counted twice
  • Errors are compilation errors
  • Only 1 test did not pass

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in