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

Expand test api to allow logging of errors during test discovery #1267

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;

import static java.util.concurrent.TimeUnit.NANOSECONDS;
Expand Down Expand Up @@ -42,7 +43,12 @@ public void executionStarted(Description description, boolean suppressParallelWa
}

@Override
public void executionFinished(Description description, boolean passed) {
public void executionFinished(Description description, boolean passed, Throwable maybeError) {

if (maybeError != null) {
LOG.log(Level.SEVERE, description.toString(), maybeError);
}

Long t0 = startTimes.remove(description);
int executionTime;
if (t0 == null) {
Expand Down Expand Up @@ -70,4 +76,5 @@ public void executionFinished(Description description, boolean passed) {

invokeQueue.recordTestOutcome(description, passed, executionTime);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public void executionStarted(Description description) {
}

@Override
public void executionFinished(Description description, boolean passed) {
public void executionFinished(Description description, boolean passed, Throwable error) {
//noop
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@ default void executionStarted(Description description) {
default void executionStarted(Description description, boolean suppressParallelWarning) {
executionStarted(description);
}
void executionFinished(Description description, boolean passed);

default void executionFinished(Description description, boolean passed) {
executionFinished(description, passed, null);
}

void executionFinished(Description description, boolean passed, Throwable error);
}