I\'m running JUnit tests on a large code base, and I\'ve been realizing that sometimes I get \"Errors\" while other times I get \"Failures\". What\'s the difference?
Source class : JUnitReportReporter.java
public void generateReport(List xmlSuites, List suites, String defaultOutputDirectory) {
//......
for (ITestResult tr : (Set) entry.getValue()) {
TestTag testTag = new TestTag();
boolean isSuccess = tr.getStatus() == 1;
if (!(isSuccess)) {
if (tr.getThrowable() instanceof AssertionError)
++errors;
else {
++failures;
}
}
}
As you can see below line in above method
tr.getThrowable() instanceof AssertionError
errors count is increased when it is instance of AssertionError otherwise(any Throwable) is counted as failures.