Skip to content

Commit

Permalink
use ScreenshotOnFailure TestWatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
EcljpseB0T committed Sep 30, 2024
1 parent 8a8979f commit c3de0e7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.rules.TestWatcher;
import org.osgi.service.log.LogLevel;
import org.osgi.service.log.LogListener;
import org.osgi.service.log.LogReaderService;
Expand Down Expand Up @@ -2972,6 +2973,9 @@ public void testBug371100() {
assertFalse(logged);
}

@Rule
public TestWatcher screenshotRule = Screenshots.onFailure();

@Test
public void testBug372226() {
assumeFalse("Test fails on Mac: Bug 537639", Platform.OS_MACOSX.equals(Platform.getOS()));
Expand All @@ -2991,8 +2995,6 @@ public void testBug372226() {
Control control = (Control) part.getWidget();
assertEquals(subShell, control.getParent());

Screenshots.takeScreenshot(getClass(), testName.getMethodName());

appContext.get(EPartService.class).activate(part);
assertEquals(subShell, control.getParent());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import org.junit.Assume;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestWatcher;

import org.eclipse.test.Screenshots;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
Expand Down Expand Up @@ -73,7 +76,9 @@
*/
public class TextViewerTest {

@Rule public ScreenshotOnFailureRule screenshotRule = new ScreenshotOnFailureRule();
@Rule
public TestWatcher screenshotRule= Screenshots.onFailure();

private Shell fShell;

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestWatcher;

import org.eclipse.test.Screenshots;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
Expand Down Expand Up @@ -57,7 +60,6 @@
import org.eclipse.jface.text.source.AnnotationModel;
import org.eclipse.jface.text.source.AnnotationPainter;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.text.tests.ScreenshotOnFailureRule;
import org.eclipse.jface.text.tests.TextViewerTest;
import org.eclipse.jface.text.tests.util.DisplayHelper;

Expand All @@ -66,7 +68,8 @@ public class CodeMiningTest {
private SourceViewer fViewer;
private Shell fShell;

@Rule public ScreenshotOnFailureRule rule = new ScreenshotOnFailureRule();
@Rule
public TestWatcher screenshotRule= Screenshots.onFailure();

@Before
public void setUp() {
Expand Down

0 comments on commit c3de0e7

Please sign in to comment.