Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Assert failed trying to navigate a tree
Assert failed trying to navigate a tree [message #532665] Mon, 10 May 2010 18:10 Go to next message
Steven Chamberlin is currently offline Steven ChamberlinFriend
Messages: 30
Registered: July 2009
Member
I am on SWT-Bot version 512. I have the following line of code:

bot.menu("Window").menu("Show View").menu("Other...").click();
--->bot.tree().expandNode("View Category").select("View Name");

I thought that these kinds of tree-drilling issues were fixed in the recent versions of SWT-Bot ... ? But it fails in only 1.6 seconds -- even though my timeout value is set to 120 seconds -- with the following assertion:

org.eclipse.swtbot.swt.finder.exceptions.AssertionFailedExce ption: assertion failed:
at org.eclipse.swtbot.swt.finder.utils.internal.Assert.isTrue(A ssert.java:95)
at org.eclipse.swtbot.swt.finder.utils.internal.Assert.isTrue(A ssert.java:83)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.select( SWTBotTreeItem.java:437)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.select( SWTBotTreeItem.java:464)
at com.ibm.datatools.swtbot.framework.ods.JavaProject.generateP ureQueryCode(JavaProject.java:54)
at com.ibm.datatools.swtbot.tests.ods.BVTTestsODS.testODS_gener atePureQueryCode(BVTTestsODS.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.eclipse.swtbot.swt.finder.SWTBotTestCase.runBare(SWTBotT estCase.java:228)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestCla ssRunner.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main( RemotePluginTestRunner.java:64)
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U ITestApplication.java:117)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Thread.java:736)


I also tried this line of code as an alternative:

bot.tree().expandNode("View Category").expandNode("View Name").click();

and it failed after 2.3 seconds (again, timeout value is 120) with this exception:

org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundExcep tion: Could not find node with text: View Name
at org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.getNode s(SWTBotTreeItem.java:329)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.getNode (SWTBotTreeItem.java:304)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.getNode (SWTBotTreeItem.java:341)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.expandN ode(SWTBotTreeItem.java:279)
at com.ibm.datatools.swtbot.framework.ods.JavaProject.generateP ureQueryCode(JavaProject.java:54)
at com.ibm.datatools.swtbot.tests.ods.BVTTestsODS.testODS_gener atePureQueryCode(BVTTestsODS.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.eclipse.swtbot.swt.finder.SWTBotTestCase.runBare(SWTBotT estCase.java:228)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestCla ssRunner.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main( RemotePluginTestRunner.java:64)
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U ITestApplication.java:117)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Thread.java:736)

The node with that text is definitely there, and I don't know how it can determine that it is not t here in a time less than the timeout value. Please advise.

Thanks!

[Updated on: Mon, 10 May 2010 18:54]

Report message to a moderator

Re: Assert failed trying to navigate a tree [message #532710 is a reply to message #532665] Mon, 10 May 2010 23:00 Go to previous messageGo to next message
Richard Adams is currently offline Richard AdamsFriend
Messages: 77
Registered: July 2009
Location: Edinburgh
Member
Hi Steven
Is the "Show View" shell opening in time? In our code we needed to activate the shell.
If you want to open your view, call doubleClick().


bot.menu("Window").menu("Other...").click();
bot.shell("Show View").activate();
bot.tree().expandNode("SBSIVisual").expandNode(VIEW_TITLE)
.doubleClick();

Cheers
Richard


Re: Assert failed trying to navigate a tree [message #532726 is a reply to message #532710] Tue, 11 May 2010 02:56 Go to previous messageGo to next message
Steven Chamberlin is currently offline Steven ChamberlinFriend
Messages: 30
Registered: July 2009
Member
Richard,

Thank you for your suggestion! I added in the bot.shell("Show View").activate() line and also used doubleClick, but I continue to see this problem intermittently. Do you ever see this? Anyone else getting this?

Thanks!
Re: Assert failed trying to navigate a tree [message #532867 is a reply to message #532726] Tue, 11 May 2010 12:23 Go to previous message
Richard Adams is currently offline Richard AdamsFriend
Messages: 77
Registered: July 2009
Location: Edinburgh
Member
We do see this sometimes when opening up the Preferences tree - intermittently a tree node we know is there, fails, despite some 'waitUntil' clauses between clicks.
But sorry don't have a guaranteed fix...


Previous Topic:Having trouble with buttons on Console view toolbar
Next Topic:Login Check in SWTBOT Against RCP
Goto Forum:
  


Current Time: Sat Apr 20 02:58:52 GMT 2024

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

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

Back to the top