Object Oriented LDTP bundled with LDTP package

With this implementation, the code can be like

* Approach 1

   1 from ooldtp import *
   2 
   3 gedit = context ('*-gedit')
   4 gedit.component.name = 'btnFind'
   5 gedit.component.click ()

* Approach 2

   1 from ooldtp import *
   2 
   3 gedit = context ('*-gedit')
   4 btnFind = gedit.child ('btnFind')
   5 btnFind.click ()

* Approach 3

   1 from ooldtp import *
   2 
   3 gedit = context ('*-gedit')
   4 gedit.component.click ('btnFind')

* Approach 4

   1 from ooldtp import *
   2 
   3 gedit = context ('*-gedit')
   4 gedit.click ('btnFind')

Welcome to Object-Oriented LDTP (EXPERIMENTAL) by Palm Source

What it is Object-Oriented LDTP?

Till now LDTP supports this kind of syntax:

   1 click('*gedit', btncopy)
   2 selectmenuitem('*gedit', 'mnuFile;mnuOpen')

it does not support appmap anymore. however I prefer using appmap to maximize its maintainability of our automation script. and I want ldtp have ability to using the following syntax to write script:

   1 frmgedt.btncopy.click()
   2 frmgedit.mnuOpen.click()

and

   1 Window('frm*gedit').PushButton('btncopy').click()
   2 Window('frm*gedit').MenuItem('mnuFile;mnuOpen').pick()

so I write a wrapper for LDTP, it wraps/improves most of LDTP API.

How to use?

use convert.py to generate the window declaration

open the file, you can find the code looks like below:

   1    from window import *
   2 
   3    class Gedit(Window):
   4        name = '*gedit'
   5 
   6        btncopy = Window.PushButton('btncopy', name)
   7        btncut = Window.PushButton('btncut', name)
   8        btnfind = Window.PushButton('btnfind', name)
   9        btnfindandreplace = Window.PushButton('btnfindandreplace', name)
  10        btngtkundo = Window.PushButton('btngtk-undo', name)
  11 
  12        mnuAbout = Window.MenuItem('mnuHelp;mnuAbout', name)
  13        mnuAda = Window.MenuItem('mnuView;mnuHighlightMode;mnuSources;mnuAda', name)
  14        mnuAllLowerCase = Window.MenuItem('mnuEdit;mnuChangeCase;mnuAllLowerCase', name)
  15        mnuAllUpperCase = Window.MenuItem('mnuEdit;mnuChangeCase;mnuAllUpperCase', name)
  16        # ...
  17    frmGedit = Gedit()

now you can do something like this

   1    frmGedit.mnuAbout.select()
   2    or write this
   3    Window('*gedit').Menu('mnuHelp;mnuAbout').select()

   1    frmGedit.btnfind.click()
   2    or write this
   3    Window('*gedit').PushButton('btnfind').click()

also you can add your own methods to this class.

That's all, enjoy it ;)

Found any bug please email me:

tae.ccf(at)gmail.com

Object-Oriented LDTP (last edited 2008-06-24 19:06:15 by NagappanAlagappan)