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

Backport #635

Merged
merged 2 commits into from
May 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[SUREFIRE-2168] Use proper en dash approximation for console report o…
…utput
  • Loading branch information
michael-o committed May 28, 2023
commit 40e1d03f2feed361ee573b0baf58c06318826672
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class JUnit5StatelessTestsetInfoReporter extends SurefireStatelessTestset

/**
* Phrased class name of test case in the log (see xxx)
* <em>Tests run: ., Failures: ., Errors: ., Skipped: ., Time elapsed: . s, - in xxx</em>.
* <em>Tests run: ., Failures: ., Errors: ., Skipped: ., Time elapsed: . s, -- in xxx</em>.
* {@code false} by default.
* <br>
* This action takes effect only in JUnit5 provider together with a test class annotated <em>DisplayName</em>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class TestSetStats {
private static final String ERRORS = "Errors: ";
private static final String SKIPPED = "Skipped: ";
private static final String FAILURE_MARKER = " <<< FAILURE!";
private static final String IN_MARKER = " - in ";
private static final String IN_MARKER = " -- in ";
private static final String COMMA = ", ";

private final Queue<WrappedReportEntry> reportEntries = new ConcurrentLinkedQueue<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public String getElapsedTimeVerbose() {

public String getElapsedTimeSummary() {
String description = getName() == null ? getSourceName() : getClassMethodName();
return description + " " + getElapsedTimeVerbose();
return description + " -- " + getElapsedTimeVerbose();
}

public boolean isErrorOrFailure() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public void testDisplayNames() {
assertTrue(wr.isErrorOrFailure());
assertFalse(wr.isSkipped());
assertNull(wr.getStackTraceWriter());
assertEquals("surefire.testcase.JunitParamsTest.testSum Time elapsed: 0.012 s", wr.getElapsedTimeSummary());
assertEquals("surefire.testcase.JunitParamsTest.testSum -- Time elapsed: 0.012 s", wr.getElapsedTimeSummary());
assertEquals(
"surefire.testcase.JunitParamsTest.testSum Time elapsed: 0.012 s <<< ERROR!", wr.getOutput(false));
"surefire.testcase.JunitParamsTest.testSum -- Time elapsed: 0.012 s <<< ERROR!", wr.getOutput(false));
assertEquals("exception", wr.getMessage());
}

Expand Down Expand Up @@ -147,6 +147,6 @@ public void testElapsed() {
ReportEntry reportEntry = new SimpleReportEntry(NORMAL_RUN, 1L, className, null, null, null);
WrappedReportEntry wr = new WrappedReportEntry(reportEntry, null, 12, null, null);
String elapsedTimeSummary = wr.getElapsedTimeSummary();
assertEquals("[0] 1, 2, 3 (testSum) Time elapsed: 0.012 s", elapsedTimeSummary);
assertEquals("[0] 1, 2, 3 (testSum) -- Time elapsed: 0.012 s", elapsedTimeSummary);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void shouldReportTestsetLifecycle() {
.hasSize(2)
.containsSequence(
"Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.03 s "
+ "<<< FAILURE! - in pkg.MyTest",
+ "<<< FAILURE! -- in pkg.MyTest",
"pkg.MyTest failed");
verifyNoMoreInteractions(consoleLogger);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public void test47() throws Exception {
containsString("Time elapsed: 1."),
containsString("Time elapsed: 1 s"),
containsString("Time elapsed: 0.9")));
assertThat(result, endsWith(" s - in concurrentjunit47.src.test.java.junit47.BasicTest"));
assertThat(result, endsWith(" s -- in concurrentjunit47.src.test.java.junit47.BasicTest"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public void testJupiterEngineWithDisplayNames() throws VerificationException {

validator
.getSurefireReportsFile("junitplatformenginejupiter.DisplayNameTest.txt", UTF_8)
.assertContainsText(" - in << ✨ >>");
.assertContainsText(" -- in << ✨ >>");

validator
.getSurefireReportsFile("junitplatformenginejupiter.DisplayNameTest-output.txt", UTF_8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
* Example, UnlistedTest is the problem here because it runs with filtered out methods:
*
* Running pkg.UnlistedTest
* Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in pkg.UnlistedTest
* Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s -- in pkg.UnlistedTest
* Running pkg.RunningTest
* Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in pkg.RunningTest
* Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s -- in pkg.RunningTest
*
* Results:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public void testMethodsParallelWithSuite() throws VerificationException {
containsString("Time elapsed: " + delayMax)));
assertThat(
line,
anyOf(endsWith(" s - in surefire747.SuiteTest1"), endsWith(" s - in surefire747.SuiteTest2")));
anyOf(
endsWith(" s -- in surefire747.SuiteTest1"),
endsWith(" s -- in surefire747.SuiteTest2")));
}
}
}
Expand Down