Skip to content

Commit

Permalink
use ScreenshotOnFailure TestWatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
EcljpseB0T authored and jukzi committed Sep 30, 2024
1 parent 1bae704 commit ebe6ec4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,8 @@ public class Test_org_eclipse_swt_custom_StyledText extends Test_org_eclipse_swt
private boolean listenerCalled;
private boolean listener2Called;

@Rule public TestWatcher screenshotRule = new TestWatcher() {
@Override
protected void failed(Throwable e, org.junit.runner.Description description) {
super.failed(e, description);
Screenshots.takeScreenshot(description.getTestClass(), description.getMethodName());
}
};
@Rule
public TestWatcher screenshotRule = Screenshots.onFailure();

@Override
@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,7 @@
public class Test_org_eclipse_swt_custom_StyledText_multiCaretsSelections {

@Rule
public TestWatcher screenshotRule = new TestWatcher() {
@Override
protected void failed(Throwable e, org.junit.runner.Description description) {
super.failed(e, description);
Screenshots.takeScreenshot(description.getTestClass(), description.getMethodName());
}
};
public TestWatcher screenshotRule = Screenshots.onFailure();

Shell shell;
StyledText text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.rules.TestWatcher;

/**
* Automated Test Suite for class org.eclipse.swt.widgets.Tree
Expand Down Expand Up @@ -915,6 +916,9 @@ public void test_disposeItemNotTriggerSelection() {
assertFalse(selectionCalled[0]);
}

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

@Test
public void test_Virtual() {
tree.dispose();
Expand Down Expand Up @@ -964,7 +968,6 @@ public void test_Virtual() {
}
// temp code to capture screenshot
if (SwtTestUtil.isCocoa) {
Screenshots.takeScreenshot(getClass(), testName.getMethodName());
// check if setData is called for root item
assertTrue("SetData not called for top item", top[0] != null);
}
Expand Down

0 comments on commit ebe6ec4

Please sign in to comment.