0

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?

  1. 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.

Nazaf Anwar
  • 339
  • 1
  • 8
  • 17
Jeevan
  • 447
  • 2
  • 8
  • 19
  • I posted to SWTDev Email and got a reply. - 1. 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 - Mickael Istria – Jeevan Mar 31 '15 at 06:30
  • 2. It may also be a limitation or a missing rule. What code would you expect the generator to create (relying on existing SWTBot API) ? - Mickael Istria – Jeevan Mar 31 '15 at 06:31
  • 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. - Mickael Istria – Jeevan Mar 31 '15 at 06:32
  • Now I have switched my project to RCPTT which is another GUI testing tool, rather than SWTBot. It is far better. – Jeevan Mar 31 '15 at 06:32
  • I am unable to post reply, please repute me so that I can post replies. Thank you. – Jeevan Mar 31 '15 at 06:34

1 Answers1

0

For your first question, instead of bot.text().setText("3.35") you should try bot.styledText().insertText(line, column, text);

Andrei Pop
  • 30
  • 4