can windowtester use other input data when play back

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

can windowtester use other input data when play back

Postby musamban1a » Thu Dec 11, 2008 6:47 pm

after i have finished recording, there are some other sets of data which are different from what i record. how can i use these data by one test class.
that means when i play back, the windowstester can import these data automaticlly :?:
musamban1a
 
Posts: 2
Joined: Thu Dec 11, 2008 6:23 pm

Re: can windowtester use other input data when play back

Postby Phil Quitslund » Thu Dec 11, 2008 7:43 pm

Could you provide a concrete example of what you're trying to do? It sounds interesting... but I'm not sure I get it. Once I know a bit more I look forward to sharing thoughts!

-phil
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: can windowtester use other input data when play back

Postby musamban1a » Sun Dec 14, 2008 10:18 pm

thanks phil :D

here is a example

ui.enterText("EVERGREEN");
ui.keyClick(WT.TAB);
ui.enterText("0783W");
ui.keyClick(WT.TAB);
ui.click(new XYLocator(new LabeledTextLocator("Desc of Goods"), -352,
26));
ui.keyClick(WT.CTRL, 'a');
ui.keyClick(WT.BS);
ui.enterText("TEST ENTRY TAB 0234nh768");

in the code, a group of text value have been set when run the play back. but there are some other groups of data i want to test. i have to record it over an over again and save them as different test class.
i just want to save these data to a excel file and windowtester can analysis and take data group by group from it. then i just record one time and it is easy to maintain the test project.

-darren
musamban1a
 
Posts: 2
Joined: Thu Dec 11, 2008 6:23 pm

Re: can windowtester use other input data when play back

Postby Phil Quitslund » Tue Dec 16, 2008 10:04 am

Hi Darren,

I would refactor the test case pulling out the good entry details into a helper method. Here's a sketch of what I mean.

Code: Select all
public class TestGoods extends UITestCaseSWT {

   static final class Good {
      String name;
      String type;
      String description;
   }

   private static final Good SAMPLE_GOOD = new Good();
   static {
      SAMPLE_GOOD.name = "EVERGREEN";
      SAMPLE_GOOD.type = "0783W";
      SAMPLE_GOOD.description = "TEST ENTRY TAB 0234nh768";
   }
   
   public void testExample() throws Exception {
      Good[] goods = getGoods();
      for (Good good : goods) {
         enter(good);
      }
   }

   private Good[] getGoods() {
      //ultimately get the goods from a datastore...
      //for now just a sample entry      
      return new Good[]{SAMPLE_GOOD};
   }


   private void enter(Good good) throws WidgetSearchException {
      enterGood(good.name, good.type, good.description);
   }

   private void enterGood(String name, String type, String description) throws WidgetSearchException {
      IUIContext ui = getUI();
      //probably need a selection here to establish initial focus
      ui.enterText(name);
      ui.keyClick(WT.TAB);
      ui.enterText(type);
      ui.keyClick(WT.TAB);
      ui.click(new XYLocator(new LabeledTextLocator("Desc of Goods"), -352,
      26));
      ui.keyClick(WT.CTRL, 'a');
      ui.keyClick(WT.BS);
      ui.enterText(description);
      //validation here?
   }
}


Obviously this is not quite right (it's missing validation at the very least), but I hope it gives you some ideas. Let me know what you think!

-phil
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest