Skip to content

Commit 32c7d9a

Browse files
committed
Use TestExecutionListener to log test start and end in org.eclipse.ui.tests
Add a JUnit Jupiter TestExecutionListener to org.eclipse.ui.tests, which logs test start and end events via UIPlugin. The listener is defined in org.eclipse.ui.tests.harness, so that it can be reused by other test bundles. Fixes: #4032
1 parent 956129f commit 32c7d9a

3 files changed

Lines changed: 44 additions & 1 deletion

File tree

tests/org.eclipse.ui.tests.harness/META-INF/MANIFEST.MF

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.208.0",
1010
org.eclipse.core.resources
1111
Bundle-ActivationPolicy: lazy
1212
Import-Package: org.junit.jupiter.api;version="[5.0.0,6.0.0)",
13-
org.junit.jupiter.api.extension;version="[5.0.0,6.0.0)"
13+
org.junit.jupiter.api.extension;version="[5.0.0,6.0.0)",
14+
org.junit.platform.engine;version="[1.14.0,2.0.0)",
15+
org.junit.platform.launcher;version="[1.14.0,2.0.0)"
1416
Export-Package: org.eclipse.ui.tests.harness,
1517
org.eclipse.ui.tests.harness.tests,
1618
org.eclipse.ui.tests.harness.util,
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2026 Simeon Andreev and others.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* Simeon Andreev - initial API and implementation
13+
*******************************************************************************/
14+
package org.eclipse.ui.tests.harness.util;
15+
16+
import org.eclipse.core.runtime.Status;
17+
import org.eclipse.ui.internal.UIPlugin;
18+
import org.junit.platform.engine.TestExecutionResult;
19+
import org.junit.platform.launcher.TestExecutionListener;
20+
import org.junit.platform.launcher.TestIdentifier;
21+
22+
/**
23+
* Logs tests start and end.
24+
*/
25+
public class LogTestListener implements TestExecutionListener {
26+
27+
@Override
28+
public void executionStarted(TestIdentifier id) {
29+
logInfo(id.getDisplayName() + " STARTING");
30+
}
31+
32+
@Override
33+
public void executionFinished(TestIdentifier id, TestExecutionResult result) {
34+
logInfo(id.getDisplayName() + " DONE: " + result.getStatus());
35+
}
36+
37+
private static void logInfo(String message) {
38+
UIPlugin.getDefault().getLog().log(Status.info(message));
39+
}
40+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.eclipse.ui.tests.harness.util.LogTestListener

0 commit comments

Comments
 (0)