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

ScreenshotOnFailure doesn't work #1518

Open
jukzi opened this issue Oct 8, 2024 · 10 comments
Open

ScreenshotOnFailure doesn't work #1518

jukzi opened this issue Oct 8, 2024 · 10 comments
Labels
junit JUnit test failure

Comments

@jukzi
Copy link
Contributor

jukzi commented Oct 8, 2024

the ScreenshotOnFailure TestWatcher produces only black images on failed tests because
the @After org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Widget.tearDown() calls shell.dispose(); before Screenshot is taken

reproducable with the failing Test_org_eclipse_swt_custom_StyledText

@jukzi jukzi added the junit JUnit test failure label Oct 8, 2024
@basilevs
Copy link
Contributor

basilevs commented Oct 8, 2024

@jukzi is this reproducible locally? Does it happen on Windows only?

@jukzi
Copy link
Contributor Author

jukzi commented Oct 8, 2024

if i force a test to fail, i can locally reproduce that only the desktop is captured but not the failed junit test (expected to show the wrong color). One the one hand that shows that the ScreenshotOnFailure does not work as intended. On the other hand the dark screen captured on the i build may indicate some screensaver on the server.

@tomaswolf
Copy link
Member

@jukzi : we ran into this screenshot taking issue (screenshot taken after the @after have run) in the EGit UI tests back in 2016. Our solution back then was to amend the SwtBotJUnit4ClassRunner to take the screenshot before the @afters. Maybe the things we did in that commit might be useful here, too.

@jukzi
Copy link
Contributor Author

jukzi commented Oct 9, 2024

if some @After/https://github.com/before method fails or a rule such as
@ExpectedException fails the test. In those cases, the behavior is
unchanged: these screenshots are still taken after @after has run.

@tomaswolf thanks, i like that idea.

@jukzi
Copy link
Contributor Author

jukzi commented Oct 11, 2024

SWTBotJunit4ClassRunner
looks a bit like TracingSuite already used in AllBrowserTests. Maybe that TracingSuite could be enhanced to take screenshots also on fail and be used in other suits as well.

jukzi pushed a commit to jukzi/eclipse.platform.releng.aggregator that referenced this issue Oct 11, 2024
jukzi pushed a commit to jukzi/eclipse.platform.swt that referenced this issue Oct 11, 2024
jukzi pushed a commit to jukzi/eclipse.platform.ui that referenced this issue Oct 11, 2024
jukzi pushed a commit to eclipse-platform/eclipse.platform.releng.aggregator that referenced this issue Oct 11, 2024
@iloveeclipse
Copy link
Member

@jukzi : some of the recent changes in this area broke a lot of UI & SWT tests.

Typical stack from https://download.eclipse.org/eclipse/downloads/drops4/I20241013-1800/testresults/html/org.eclipse.swt.tests_ep434I-unit-cen64-gtk3-java17_linux.gtk.x86_64_17.html

Cannot invoke "java.util.function.Supplier.get()" because "this.shell" is null

java.lang.NullPointerException: Cannot invoke "java.util.function.Supplier.get()" because "this.shell" is null
at org.eclipse.test.Screenshots$ScreenshotOnFailure.dispose(Screenshots.java:52)
at org.eclipse.test.Screenshots$ScreenshotOnFailure.finished(Screenshots.java:47)

Could you please fix it?

@jukzi
Copy link
Contributor Author

jukzi commented Oct 14, 2024 via email

@iloveeclipse
Copy link
Member

Can u please just add a obvious null check. (I am afk)

OK, see eclipse-platform/eclipse.platform.releng.aggregator#2452

@jukzi
Copy link
Contributor Author

jukzi commented Oct 14, 2024 via email

akurtakov pushed a commit to eclipse-platform/eclipse.platform.releng.aggregator that referenced this issue Oct 14, 2024
jukzi pushed a commit to jukzi/eclipse.platform.ui that referenced this issue Oct 17, 2024
jukzi pushed a commit to jukzi/eclipse.platform.swt that referenced this issue Oct 17, 2024
jukzi pushed a commit to eclipse-platform/eclipse.platform.ui that referenced this issue Oct 17, 2024
jukzi pushed a commit to jukzi/eclipse.platform.swt that referenced this issue Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
junit JUnit test failure
Projects
None yet
Development

No branches or pull requests

4 participants