Skip to content

Commit cc66009

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. Additionally, usage of TestRunLogUtil.LOG_TESTRUN rule is removed, since the new listener covers the rule functionality. Fixes: #4032
1 parent 1e6a7c9 commit cc66009

14 files changed

Lines changed: 45 additions & 51 deletions

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+
}

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MultipleWindowsTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,15 @@
1919
import org.eclipse.ui.IWorkbenchWindow;
2020
import org.eclipse.ui.PlatformUI;
2121
import org.eclipse.ui.WorkbenchException;
22-
import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
2322
import org.junit.After;
2423
import org.junit.Before;
25-
import org.junit.Rule;
2624
import org.junit.Test;
27-
import org.junit.rules.TestWatcher;
2825

2926
/**
3027
* A set of tests for multiple monitor situations that ensures interactions are
3128
* isolated to the respective window.
3229
*/
3330
public class MultipleWindowsTest {
34-
@Rule
35-
public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
3631

3732
IWorkbench wb;
3833
IWorkbenchWindow win1;

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/filteredtree/PatternFilterTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,10 @@
2323
import org.eclipse.jface.viewers.ISelection;
2424
import org.eclipse.swt.widgets.Control;
2525
import org.eclipse.ui.dialogs.PatternFilter;
26-
import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
2726
import org.junit.Before;
28-
import org.junit.Rule;
2927
import org.junit.Test;
30-
import org.junit.rules.TestWatcher;
3128

3229
public class PatternFilterTest {
33-
@Rule
34-
public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
3530

3631
private class MockViewer extends ContentViewer {
3732

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/markers/MarkerHelpRegistryReaderTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,12 @@
2222
import org.eclipse.ui.internal.ide.registry.MarkerHelpRegistry;
2323
import org.eclipse.ui.internal.ide.registry.MarkerHelpRegistryReader;
2424
import org.eclipse.ui.internal.ide.registry.MarkerQuery;
25-
import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
26-
import org.junit.Rule;
2725
import org.junit.Test;
28-
import org.junit.rules.TestWatcher;
2926

3027
/**
3128
* The test class for {@link MarkerHelpRegistryReader}.
3229
*/
3330
public class MarkerHelpRegistryReaderTest {
34-
@Rule
35-
public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
3631

3732
/**
3833
* Tests if the matchChildren flag of the contributions to the markerHelp

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/markers/MarkerHelpRegistryTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,14 @@
2525
import org.eclipse.core.resources.ResourcesPlugin;
2626
import org.eclipse.ui.internal.ide.registry.MarkerHelpRegistry;
2727
import org.eclipse.ui.internal.ide.registry.MarkerHelpRegistryReader;
28-
import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
2928
import org.junit.After;
3029
import org.junit.Before;
31-
import org.junit.Rule;
3230
import org.junit.Test;
33-
import org.junit.rules.TestWatcher;
3431

3532
/**
3633
* The test class for {@link MarkerHelpRegistry}.
3734
*/
3835
public class MarkerHelpRegistryTest {
39-
@Rule
40-
public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
4136

4237
static final String ATT_HELP_CONTEXT = "helpContext";
4338
static final String ATT_HAS_HELP = "hasHelp";

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/markers/MarkerQueryTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,14 @@
2121
import org.eclipse.core.resources.IWorkspaceRoot;
2222
import org.eclipse.core.resources.ResourcesPlugin;
2323
import org.eclipse.ui.internal.ide.registry.MarkerQuery;
24-
import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
2524
import org.junit.After;
2625
import org.junit.Before;
27-
import org.junit.Rule;
2826
import org.junit.Test;
29-
import org.junit.rules.TestWatcher;
3027

3128
/**
3229
* The test class for {@link MarkerQuery}.
3330
*/
3431
public class MarkerQueryTest {
35-
@Rule
36-
public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
3732

3833
private IMarker marker;
3934
private IMarker child_marker;

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/preferences/ZoomAndPreferencesFontTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,18 @@
3535
import org.eclipse.ui.commands.ICommandService;
3636
import org.eclipse.ui.internal.themes.ColorsAndFontsPreferencePage;
3737
import org.eclipse.ui.part.FileEditorInput;
38-
import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
3938
import org.eclipse.ui.texteditor.AbstractTextEditor;
4039
import org.junit.After;
4140
import org.junit.Assert;
4241
import org.junit.Assume;
4342
import org.junit.Before;
4443
import org.junit.BeforeClass;
45-
import org.junit.Rule;
4644
import org.junit.Test;
47-
import org.junit.rules.TestWatcher;
4845

4946
/**
5047
* @since 3.11
5148
*/
5249
public class ZoomAndPreferencesFontTest {
53-
@Rule
54-
public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
5550

5651
private static IProject project;
5752
private static IFile file;

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/JobInfoTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,10 @@
2525
import org.eclipse.core.runtime.jobs.Job;
2626
import org.eclipse.ui.internal.progress.JobInfo;
2727
import org.eclipse.ui.internal.progress.JobSnapshot;
28-
import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
2928
import org.junit.Before;
30-
import org.junit.Rule;
3129
import org.junit.Test;
32-
import org.junit.rules.TestWatcher;
3330

3431
public class JobInfoTest {
35-
@Rule
36-
public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
3732

3833

3934
/**

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/JobInfoTestOrdering.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,9 @@
2525
import org.eclipse.core.runtime.jobs.Job;
2626
import org.eclipse.ui.internal.progress.JobInfo;
2727
import org.eclipse.ui.internal.progress.JobSnapshot;
28-
import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
29-
import org.junit.Rule;
3028
import org.junit.Test;
31-
import org.junit.rules.TestWatcher;
3229

3330
public class JobInfoTestOrdering {
34-
@Rule
35-
public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
3631

3732
/**
3833
* Test that checks when jobs sorted by their state, the running ones

0 commit comments

Comments
 (0)