Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now tests with assumption violations are flagged with 'I' #1528

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/org/junit/internal/TextListener.java
Expand Up @@ -42,6 +42,11 @@ public void testFailure(Failure failure) {
public void testIgnored(Description description) {
writer.append('I');
}

@Override
public void testAssumptionFailure(Failure failure) {
writer.append('I');
}

/*
* Internal methods
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/junit/runner/Result.java
Expand Up @@ -137,7 +137,7 @@ public void testIgnored(Description description) throws Exception {

@Override
public void testAssumptionFailure(Failure failure) {
// do nothing: same as passing (for 4.5; may change in 4.6)
ignoreCount.getAndIncrement();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #1294 (currently targeted for 4.13) we are proposing updating this class to collect assumption failure counts, so I am not sure we should make this change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh great! in my opinion add a counter for the assumption failures would be great in order to know exactly how many did the test have

}
}

Expand Down
Expand Up @@ -40,7 +40,7 @@ public void assumptionsFail() {
public void failedAssumptionsMeanPassing() {
Result result = JUnitCore.runClasses(HasFailingAssumption.class);
assertThat(result.getRunCount(), is(1));
assertThat(result.getIgnoreCount(), is(0));
assertThat(result.getIgnoreCount(), is(1));
assertThat(result.getFailureCount(), is(0));
}

Expand Down
Expand Up @@ -808,7 +808,7 @@ public void testAssumptionFailure(Failure failure) {
Result failureResult = core.run(ParameterizedAssumtionViolation.class);
assertTrue(failureResult.wasSuccessful());
assertEquals(0, failureResult.getRunCount());
assertEquals(0, failureResult.getIgnoreCount());
assertEquals(1, failureResult.getIgnoreCount());
assertEquals(1, assumptionFailures.size());
}
}