Writing LDTP test scripts in Python scripting language

Setup LDTP

Platform

import LDTP modules

Example 1:

Example 2:

LDTP API

Call a function to perform an operation

LDTP generally operates on the given object in a particular window.

To select a menu item, you need to call selectmenuitem function. For example, to select open menu item in gedit application, call the below function

When you call the above a new dialog box will be poped up, you can verify whether the window is opened or not either by guiexist or by waittillguiexist

If you want to operate on a push button in a window, you need to call click function:

To press 'Cancel' button in a GTK Open File Selector dialog

When you do the above operation the GTK File selector dialog disappears. To verify whether the window actually quits or not use waittillguinotexist function

If you modify any opened file in gedit, the window title will be modified. To continue operating on the window you need to change your context of operation. Reason: As you are aware that LDTP works based on individual window, the context of window will be changed, when the title changes. To over come this use setcontext function and when you don't require them use releasecontext

Edit your current opened file using:

This will change the window title. Note, before doing the above operation, title will be 'Unsaved Document 1 - gedit' and after editing the title will look like '*Unsaved Document 1 - gedit'. To further operate on the same window, use

So that you can continue using the same window name, for example:

The above function will invoke the GTK save dialog box

If any of the action releated functions (example: selectmenuitem, click, settextvalue) fail, an exception is raised. It has to be handled by the program to either continue operating on execution or just halt

Executing LDTP scripts

Debugging LDTP issues

Generating LDTP scripts

Test Data

Test cases / Scenarios

Reference

Filing bugs

LDTP usage help

Hacking LDTP

Useful Links

Other Reference About Appmap, Appmap convention

LDTP test scripts in python (last edited 2008-07-14 21:00:07 by NagappanAlagappan)