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

use ScreenshotOnFailure TestWatcher #1479

Merged
merged 1 commit into from
Sep 30, 2024
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 @@ -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
Loading