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 08:55 Go to next message
Yoed Yahav is currently offline Yoed Yahav
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 10:07 Go to previous messageGo to next message
Yoed Yahav is currently offline Yoed Yahav
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 03:25 Go to previous messageGo to next message
Jan Krakora is currently offline Jan Krakora
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 03:09 Go to previous messageGo to next message
Yoed Yahav is currently offline Yoed Yahav
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 04:37 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger Herrmann
Messages: 563
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 06:05 Go to previous messageGo to next message
Yoed Yahav is currently offline Yoed Yahav
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 10:04 Go to previous message
Mickael Istria is currently offline Mickael Istria
Messages: 741
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 10:04 Go to previous message
Mickael Istria is currently offline Mickael Istria
Messages: 741
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
Previous Topic:Can SWTBot support pure SWT application
Next Topic:SWTBot with e4 product
Goto Forum:
  


Current Time: Thu Aug 21 14:12:25 EDT 2014

Powered by FUDForum. Page generated in 0.05227 seconds