Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » @RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure
@RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure [message #879056] Wed, 30 May 2012 12:55 Go to next message
Yoed Yahav is currently offline Yoed YahavFriend
Messages: 7
Registered: April 2012
Junior Member
Hi,

I followed all the instructions to use "@RunWith(SWTBotJunit4ClassRunner.class)" to capture screenshots on a test failure but i can't find the screenshot anywhere.
In addition I can't find any console entry that shows if it was successful or not.

Has anyone encountered this issue?
Re: @RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure [message #879099 is a reply to message #879056] Wed, 30 May 2012 14:07 Go to previous messageGo to next message
Yoed Yahav is currently offline Yoed YahavFriend
Messages: 7
Registered: April 2012
Junior Member
By the way, I debugged it and I can see that the screen is captured, the capture on failure returns 'true', the HTML report includes the reference to the file, but there's no file whatsoever in the screenshots directory...
Weird...
Re: @RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure [message #889885 is a reply to message #879099] Wed, 20 June 2012 07:25 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi Yoed,

If you debug it, then you should see what folder the SWTbot use for saving the snapshot, doesn't you?
Take a look at the ScreenshotCaptureListener.captureScreenshot(Failure failure) where is the path constructed and you'll see where the images go to.
Re: @RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure [message #898298 is a reply to message #889885] Thu, 26 July 2012 07:09 Go to previous messageGo to next message
Yoed Yahav is currently offline Yoed YahavFriend
Messages: 7
Registered: April 2012
Junior Member
Thanks Jan for the tip!
I checked it out, and indeed I had to set SWTBotPreferences.SCREENSHOTS_DIR for the screenshots to appear.

One problem though
SWTBot saves the screenshots on failures but they are all white. No window content whatsoever.

Does anyone know this phenomena?

Thanks

P.S I'm running my tests on Jenkins slave machine, using the headless framework. Is that the reason?
Re: @RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure [message #898331 is a reply to message #898298] Thu, 26 July 2012 08:37 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
I observed similar, also when running SWTBot tests locally. As far as I
can tell, the screenshot is taken too late. In my case the screenshot is
taken after the tearDown (@After-annotated) method is executed.

The SWTBot runner would have to take the screenshot _before_ tear down.
Not sure though if custom JUnit runners have a chance to intercept at
that point.

I filed this bug, but there hasn't been any response so far:
372209: Take screenshot before teardown
https://bugs.eclipse.org/bugs/show_bug.cgi?id=372209

Regards,
Rüdiger
--
Rüdiger Herrmann
http://codeaffine.com

On 26.07.2012 09:09, Yoed Yahav wrote:
> Thanks Jan for the tip!
> I checked it out, and indeed I had to set
> SWTBotPreferences.SCREENSHOTS_DIR for the screenshots to appear.
>
> One problem though
> SWTBot saves the screenshots on failures but they are all white. No
> window content whatsoever.
>
> Does anyone know this phenomena?
>
> Thanks
>
> P.S I'm running my tests on Jenkins slave machine, using the headless
> framework. Is that the reason?
Re: @RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure [message #898384 is a reply to message #898331] Thu, 26 July 2012 10:05 Go to previous messageGo to next message
Yoed Yahav is currently offline Yoed YahavFriend
Messages: 7
Registered: April 2012
Junior Member
I see that you filed this defect on February...
Unfortunately I've been trying to reach Ketan (Padegaonkar) myself for a few weeks already, but it seems that he hardly ever checks out the SWTBot forums and bugs.
Too bad.

Thanks Rüdiger for your attention... I hope that this issue will be resolved soon.
I'll monitor the bug too.
Re: @RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure [message #899344 is a reply to message #898384] Tue, 31 July 2012 14:04 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

All current efforts around SWTBot are currently focused on support for
Eclipse Workbench 4.2.
If you want this issue to progress, you should consider providing a test
case and a patch.

--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: @RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure [message #899347 is a reply to message #898384] Tue, 31 July 2012 14:04 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

All current efforts around SWTBot are currently focused on support for
Eclipse Workbench 4.2.
If you want this issue to progress, you should consider providing a test
case and a patch.

--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
icon5.gif  Re: @RunWith(SWTBotJunit4ClassRunner.class) won't catch screenshots on failure [message #1485646 is a reply to message #899344] Mon, 24 November 2014 12:16 Go to previous message
Jeff MAURY is currently offline Jeff MAURYFriend
Messages: 44
Registered: July 2009
Member
I think that the feature is not usable if your unit tests do a proper cleanup even if they fail. So SWTBot should provide an API that does the same kind of thing (using the configured output directory and generating the file name for the test class and the test method name given as input). A method exists in SWTUtils but your have to deal with too much info.

[Updated on: Mon, 24 November 2014 12:18]

Report message to a moderator

Previous Topic:SWTBotTreeItem's context menu click gives TimeoutException
Next Topic:Changing font and background color of only header in SWT table
Goto Forum:
  


Current Time: Thu Mar 28 12:30:40 GMT 2024

Powered by FUDForum. Page generated in 0.03416 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top