Skip to main content


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 fultonFriend
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 BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
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 nameFriend
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: Fri Apr 26 15:51:37 GMT 2024

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

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

Back to the top