Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot Recorder is not absolute(SWTBot Recorder generated test cases are not good enough. )
SWTBot Recorder is not absolute [message #1660726] Mon, 09 March 2015 10:03 Go to next message
Jeevan Rex is currently offline Jeevan RexFriend
Messages: 80
Registered: March 2015
Location: Bangalore
Member
I am trying SWTBot in our own application. I am trying to use SWTBot Recorder to create my test cases first. But I am facing few issues.

I have two questions. Please check on the comments I mentioned in each one below.

1. I have a table view. It contains data which I imported from a csv file. The following is the code which SWTBot gave me.
bot.menu("File").menu("New...").click();
bot.tree().getTreeItem("AppName").select();
bot.tree().getTreeItem("AppName ").select();
bot.textWithLabel("IP Version:").setText("Sample");
bot.text(1).setText("App");
bot.text(2).setText("1");
bot.textWithLabel("*").setText("Hello");
bot.button("Finish").click();
bot.tree().getTreeItem("Sample").expand();
bot.tree().getTreeItem("Sample").getNode("App(1)").expand();
bot.tree().getTreeItem("Sample").getNode("App(1)").getNode("Hello").select();
bot.contextMenu("Open Application Metadata File").click();
// I choose the location of my .csv file which is also not recorded in this.
bot.text().setText("3.35"); //Edited data from the table No mention of which row and which column.
bot.text().setText("3.3");
bot.text().setText("Synthesiss");

Is there a way to mention which row and which column of the table I am dealing with now?

2. I have a SashForm with two Composite. Each Composite contain a grid of almost the same data and same button names. When I try to run SWTBot Recorder and try to click on the Grids, it is not saying which Grid which I am dealing with now. The following is the code which produced.
bot.menu("AppName").menu("Open Config").click();
bot.button("Load").click(); //clicked from Composite 1
bot.button("Load").click(); //clicked from Composite 2
bot.tree().getTreeItem("").select(); //clicked from Grid of Composite 1 Text not detected
bot.tree().getTreeItem(
"").select();//clicked from Grid of Composite 1 Text not detected
bot.menu("QConnect+").menu("Close Config").click();
Is it possible with SWTBot to find which Composite I am dealing with?
This SashForm exist inside a tab, just like "Package Explorer", for example. How does SWTBot identify which tab is it now dealing with.

Are the Test produced by SWTBot absolute?

Please let me know if there are any solution for these and where can I find it.
Re: SWTBot Recorder is not absolute [message #1690274 is a reply to message #1660726] Thu, 26 March 2015 09:46 Go to previous messageGo to next message
Jeevan Rex is currently offline Jeevan RexFriend
Messages: 80
Registered: March 2015
Location: Bangalore
Member
I got a reply for this via email, which I sent to swtbot dev team. From mistria@______.com

Hi,
// I choose the location of my .csv file which is also not recorded in this.
Is there a way to mention which row and which column of the table I am dealing with now?
The recorder doesn't have rules to deal correctly with tables yet. Please open a bug to request it, with the expected output in that case, and consider contributing the necessary rule. (see http :// git.eclipse.org/c/swtbot/org.eclipse.swtbot.git/tree/org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/framework/rules/simple/ExpandTreeItemRule.java as an example): https :// wiki.eclipse.org/SWTBot/Contributing


2. I have a SashForm with two Composite. Each Composite contain a grid of almost the same data and same button names. When I try to run SWTBot Recorder and try to click on the Grids, it is not saying which Grid which I am dealing with now. The following is the code which produced.
Is it possible with SWTBot to find which Composite I am dealing with?
This SashForm exist inside a tab, just like "Package Explorer", for example. How does SWTBot identify which tab is it now dealing with.
It may also be a limitation or a missing rule. What code would you expect the generator to create (relying on existing SWTBot API) ?


Are the Test produced by SWTBot absolute?

The state of your application when you start recording may affect the code generated. For example, initial selection and active views can make the recorder skip the rules about selection and activation. So those tests are not absolute but more relative to the state of your application when starting to record.

HTH
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat

[Updated on: Thu, 26 March 2015 15:56] by Moderator

Report message to a moderator

Re: SWTBot Recorder is not absolute [message #1690326 is a reply to message #1690274] Thu, 26 March 2015 15:56 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
Moving this to the SWTBot fourm. For future reference, please ask SWT Bot questions there.
Re: SWTBot Recorder is not absolute [message #1761038 is a reply to message #1690274] Fri, 05 May 2017 14:07 Go to previous messageGo to next message
Vaibhav N is currently offline Vaibhav NFriend
Messages: 5
Registered: May 2017
Junior Member
Are these issues fixed in new releases?
I am also looking to recorder for Tree/table widgets with particular row numbers etc.
Re: SWTBot Recorder is not absolute [message #1761192 is a reply to message #1761038] Mon, 08 May 2017 17:29 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 56
Registered: July 2009
Member
Hi Vaibhav,

With the exception of the new SWTBot Recorder client/server feature in the upcoming 2.6.0 release, there hasn't been any development in SWTBot Recorder for a few years (no new rules or widgets supported by the recorder).

If you would like to contribute some improvements, we can review your patches.

Patrick
Re: SWTBot Recorder is not absolute [message #1763552 is a reply to message #1660726] Wed, 17 May 2017 10:56 Go to previous messageGo to next message
jyoti Chopade is currently offline jyoti ChopadeFriend
Messages: 2
Registered: May 2017
Junior Member
I am not able to capture the Save button oof the dialog box "Export to Zip File".
I tried with different solutions like below but still facing the issue

1.
SWTBotShell shell = bot.shell("Export to Zip File");
SWTBot shellBot = shell.bot();
SWTBotButton button = shellBot.button("Save");
button.click();

2.
SWTBotButton btnSave =bot.button("Save");
btnSave.click();

Re: SWTBot Recorder is not absolute [message #1763789 is a reply to message #1763552] Fri, 19 May 2017 16:49 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 56
Registered: July 2009
Member
Hi Jyoti,

Is this about SWT Recorder or a different issue?

In any case, is your Export to Zip File dialog a native FileDialog? It's not possible to test those native dialogs using SWTBot.

You can look here for an example way to work around the problem. It requires the application to be modified to use this class instead of the native FileDialog, however.

http://git.eclipse.org/c/tracecompass/org.eclipse.tracecompass.git/tree/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/dialog/TmfFileDialogFactory.java
Re: SWTBot Recorder is not absolute [message #1776451 is a reply to message #1763789] Thu, 16 November 2017 14:20 Go to previous messageGo to next message
Vaibhav N is currently offline Vaibhav NFriend
Messages: 5
Registered: May 2017
Junior Member
Hi Patrick,

Do we have any way to catch 'org.eclipse.swt.custom.CCombo' selections/events like you mentioned for native dialogs?
SWTBot Test Recorder does not capture the CCombo selections/data.
Thanks!
Re: SWTBot Recorder is not absolute [message #1776564 is a reply to message #1776451] Fri, 17 November 2017 17:58 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 56
Registered: July 2009
Member
Hi Vaibhav,

As far as I can tell the SWTBot Test Recorder can capture CCombo selection? See org.eclipse.swtbot.generator.framework.rules.simple.CComboSelectionRule.

When I try it I get two code lines created though:

bot.list().select("foo");
bot.ccomboBox().select("foo");

I think this is because the CCombo custom widget opens a Shell with a List when clicking the drop-down Button, and it then intercepts the List SWT.Selection event to fire its own CCombo SWT.Selection event. See CCombo.listEvent(Event).

Probably the list.select() then fails when running the generated SWTBot code? For now you could just remove it manually.

I guess the SelectionListItemRule should be enhanced to ignore SWT.Selection events coming from a List that is part of a CCombo. We will gladly review any contribution to fix this.

Patrick
Re: SWTBot Recorder is not absolute [message #1776748 is a reply to message #1776564] Tue, 21 November 2017 07:35 Go to previous messageGo to next message
Vaibhav N is currently offline Vaibhav NFriend
Messages: 5
Registered: May 2017
Junior Member
Yes Patrick, I checked CComboSelectionRule class, it works.
Issue was with TableViewer. CCombo is part of my table viewer, it is field in table so generator could not catch the event. My bad!
How to get information from table viewer to SWT generator? I would appreciate if you can give me some clue so that I can test it locally.
Re: SWTBot Recorder is not absolute [message #1776765 is a reply to message #1776748] Tue, 21 November 2017 12:14 Go to previous messageGo to next message
Aparna Argade is currently offline Aparna ArgadeFriend
Messages: 44
Registered: October 2010
Member
Hi Vaibhav,
I'm able to reproduce your problem. I also have CCombo on Table. The generator does not generate code for me too.
I now know the fix for this!

CCombo's selection event triggers Text's Modify event(CCombo.java:1165). So ModifyTextRule needs to be modified. If Text's parent is CCombo then it should not handle that event.

Currently it gets java.lang.ArrayIndexOutOfBoundsException: -2
at org.eclipse.swtbot.generator.framework.WidgetUtils.getPreviousControl(WidgetUtils.java:125)
at org.eclipse.swtbot.generator.framework.WidgetUtils.widgetLocator(WidgetUtils.java:141)
at org.eclipse.swtbot.generator.framework.rules.simple.ModifyTextRule.initializeForEvent(ModifyTextRule.java:39)

Patrick, I'll create a patch for this in 1-2 days.

Aparna
Re: SWTBot Recorder is not absolute [message #1776771 is a reply to message #1776765] Tue, 21 November 2017 12:52 Go to previous messageGo to next message
Vaibhav N is currently offline Vaibhav NFriend
Messages: 5
Registered: May 2017
Junior Member
Thanks Aparna for quick updates. Yes, the same stack trace is shown in console.
I also thought of 'initializeForEvent' method should be updated from ModifyTextRule class to support CCombo, but was not sure for fix.
Waiting for your patch :)

Another question, how to get row numbers from table( updating data in TableViewer/Table) through SWTBot generator? any suggestions?


Re: SWTBot Recorder is not absolute [message #1780070 is a reply to message #1776771] Wed, 17 January 2018 06:00 Go to previous message
Aparna Argade is currently offline Aparna ArgadeFriend
Messages: 44
Registered: October 2010
Member
Hi all,
This is to inform that latest snapshot SWTBot now supports following additional rules and fixes for some of the existing rules-
1. New rules for TableItem's Selection (single/multi), Check and Double-click
2. New rule for TreeItem's Check
3. New rule for CCombo setText
4. Fix for CCombo Selection
5. Fix for TreeItem Double-click
Previous Topic:RAP Automation
Next Topic:Automated test execution without showing display
Goto Forum:
  


Current Time: Sat Nov 17 19:02:36 GMT 2018

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

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

Back to the top