Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » source level debug of SWTBot code(testcase debug)
source level debug of SWTBot code [message #822535] Fri, 16 March 2012 20:59 Go to next message
mike fulton is currently offline mike fulton
Messages: 3
Registered: December 2011
Junior Member
Hi

I am trying to debug a simple SWTBot test and, I have found that when I try to single-step through the code in the JDT debugger, it fails.

Since I am new to SWTBot, I am not sure if this is because my test is being written wrong, if what I am trying to do isn't supported, I need to set timeouts extremely large, or it's a bug in SWTBot.

Here's a simple scenario. I try to step through this code:

a) SWTBotMenu mw = bot.menu("Window").click();
b) SWTBotMenu mp = mw.menu("Project Explorer").click();

c) SWTBotMenu file = bot.menu("File");
d) SWTBotMenu n = file.menu("New").click();
e) SWTBotMenu p = n.menu("File").click();

If I just 'set a breakpoint' somewhere, it will run fine to that point. But - when I go to step over the line to the next line, it invariably fails.

To be concrete, if I set a breakpoint on line (b), and run, then when I get control on line (b), I step over to line (c), I get a 'WidgetNotFoundException' being thrown. If I had set the breakpoint on line (c), it would have run clean to that line.
Re: source level debug of SWTBot code [message #822820 is a reply to message #822535] Sat, 17 March 2012 10:03 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1368
Registered: July 2009
Senior Member
On 03/16/2012 09:59 PM, mike fulton wrote:
> Hi
>
> I am trying to debug a simple SWTBot test and, I have found that when I
> try to single-step through the code in the JDT debugger, it fails.
> Since I am new to SWTBot, I am not sure if this is because my test is
> being written wrong, if what I am trying to do isn't supported, I need
> to set timeouts extremely large, or it's a bug in SWTBot.
> Here's a simple scenario. I try to step through this code:
>
> a) SWTBotMenu mw = bot.menu("Window").click();
> b) SWTBotMenu mp = mw.menu("Project Explorer").click();
>
> c) SWTBotMenu file = bot.menu("File");
> d) SWTBotMenu n = file.menu("New").click();
> e) SWTBotMenu p = n.menu("File").click();
>
> If I just 'set a breakpoint' somewhere, it will run fine to that point.
> But - when I go to step over the line to the next line, it invariably
> fails.
> To be concrete, if I set a breakpoint on line (b), and run, then when I
> get control on line (b), I step over to line (c), I get a
> 'WidgetNotFoundException' being thrown. If I had set the breakpoint on
> line (c), it would have run clean to that line.

As far as I know when running an swtbot test the running eclipse must
have the focus (and you should not do anything else with mouse and
keyboard); thus it might be hard to debug... Again, this is how I
understand running swtbot tests, but I might be wrong...

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Re: source level debug of SWTBot code [message #823921 is a reply to message #822820] Mon, 19 March 2012 03:12 Go to previous message
benhu Missing name is currently offline benhu Missing name
Messages: 14
Registered: October 2010
Junior Member

[quote title=Lorenzo Bettini wrote on Sat, 17 March 2012 06:03]On 03/16/2012 09:59 PM, mike fulton wrote:
> Hi
>
> I am trying to debug a simple SWTBot test and, I have found that when I
> try to single-step through the code in the JDT debugger, it fails.
> Since I am new to SWTBot, I am not sure if this is because my test is
> being written wrong, if what I am trying to do isn't supported, I need
> to set timeouts extremely large, or it's a bug in SWTBot.
> Here's a simple scenario. I try to step through this code:
>
> a) SWTBotMenu mw = bot.menu("Window").click();
> b) SWTBotMenu mp = mw.menu("Project Explorer").click();
>
> c) SWTBotMenu file = bot.menu("File");
> d) SWTBotMenu n = file.menu("New").click();
> e) SWTBotMenu p = n.menu("File").click();
>
> If I just 'set a breakpoint' somewhere, it will run fine to that point.
> But - when I go to step over the line to the next line, it invariably
> fails.
> To be concrete, if I set a breakpoint on line (b), and run, then when I
> get control on line (b), I step over to line (c), I get a
> 'WidgetNotFoundException' being thrown. If I had set the breakpoint on
> line (c), it would have run clean to that line.

As far as I know when running an swtbot test the running eclipse must
have the focus (and you should not do anything else with mouse and
keyboard); thus it might be hard to debug... Again, this is how I
understand running swtbot tests, but I might be wrong...

cheers
Lorenzo

I agree with you.
"when running an swtbot test the running eclipse must
have the focus (and you should not do anything else with mouse and
keyboard);"
Previous Topic:Problem executing SWTbot+Junit4 test
Next Topic:find a context menu (which has a keyboard shortcut)
Goto Forum:
  


Current Time: Thu Oct 23 02:29:02 GMT 2014

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

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