Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » context changes in SWTWorkbenchBot
context changes in SWTWorkbenchBot [message #468283] Tue, 04 August 2009 20:29
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 155
Registered: July 2009
Senior Member
This is an example of changes in the context of the SWTWorkbenchBot bot.
In this testing example, I'm exercising in the C perspective of CDT, with
a mingw environnment. In development I noted that it was necessary to
create and use cBuildItem to restore the context to a point where it could
find "Settings" in the tree. The tree() execution in bot.tree() would
fail at the point marked with the 2. comment. This is what I mean by the
context changing. Even though I haven't made and explicit assignment to
change bot, bot.tree() works the first time, but fails the second time.
What seems to me to be happening is that the search context for bot
changes, perhaps to the last widget selected, although I don't see this
explained anywhere.


//Open the project properties for project C1 through its pop-up context
menus.

bot.viewByTitle("Project Explorer").setFocus();
SWTBotTreeItem c1Tree = bot.tree().expandNode("C1").select().click();
c1Tree.contextMenu("Properties").click();
SWTBotShell shellProperties = bot.shell("Properties for C1");
shellProperties.activate();
shellProperties.setFocus();

// 1. Open the Discovery Options and test for some items in its "Discovery
profile" combo box

SWTBotTreeItem cBuildItem = bot.tree().expandNode("C/C++
Build").select().click();
cBuildItem.select("Discovery Options").click();
SWTBotCombo discoveryCombo = bot.comboBoxWithLabelInGroup("Discovery
profile:", "Automated discovery of paths and symbols");
String[] comboItems = discoveryCombo.items();
assertThat (comboItems,hasItemInArray("Managed Build System - per project
scanner info profile"));
assertThat (comboItems,not(hasItemInArray("xx")));

// 2. Open its Settings->Binary Parsers tab and check for some items in
its Table
// (CheckboxTableViewer). Note that here I'm starting from the cBuildItem.
// It will otherwise fail bot.tree() if I duplicate the code that created
cBuildItem
// at this point.

cBuildItem.select("Settings").click();
SWTBotTabItem binaryParsersTab = bot.tabItem("Binary Parsers").activate();
SWTBotTable bpTab = bot.table();
assertTrue(bpTab.containsItem("PE Windows Parser"));
assertFalse(bpTab.containsItem("PE Windows Parser2"));
Previous Topic:C tools test cases
Next Topic:Re: [Bug 269609] GEF editors support
Goto Forum:
  


Current Time: Thu Apr 18 23:17:03 GMT 2024

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

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

Back to the top