How to create Test Tables for LDTP

From LDTP


How to develop test tables for LDTP -- Under construction


The aim of this tutorial is to teach how to automate test cases using LDTP framework.

There are four steps involved in automating a test case using LDTP framework.

I.   Writing test case steps.
II.  Creating the application map. gedit.map
III. Creating the test table. open-new-file.sdd
IV. Running the test case through LDTP.

I. Writing test case steps:


For the purpose of understanding, let us consider the following test case as an example.

Test Case: Opening a new file in gedit.


Pre-condition: gedit must be running.


Steps :
1.Click the File menu.
2.Click the New menu item under the File menu.
   Note: gedit is a text editor.

II. Creating the application Map:

Any application window is nothing but a collection of objects like frame, menu bar, menus, menu items, push buttons, check boxes, etc.. They have certain properties through which we can distinguish one object from any other object.

The properties are as follows: class, app_name, label, parent etc.

class is nothing but the type of the

object, like menu, menu_item, push button etc.

app_name is the name of the application

which started that window.

label is the name which is shown to

the user.

parent is the object which contains this object or a container.


With this background, we will be able to represent the gedit window and few objects.

Naming Convention
wnd - this prefix is used to represent Window.
mnu - this prefix is used to represent Menu

[wndGedit]

wndGedit={class=frame, app_name=gedit} -- this represents the main window frame.
mnuFile={class=menu, label=File} -- this represents the File menu.
mnuNew={class=menu_item, label=New, parent=mnuFile} -- this represents the New menu item under File menu.


This is the application map for our test case. Save this in a file appmap.map

The format of the map is as follows.

[window]
window={property1=value1, property2=value2}
object1={property1=value1, property2=value2}


But how do we know what is the class name of the object.

AT-POKE is the tool which can help us in probing this information for us.


To know how to use at-poke

For LDTP framework requires Assistive Technology Support to be enabled. If you have not done that already.

To generate appmap type ./appmap <application name> in a terminal window.
You should be in the following directory while generating the appmap:
/ldtp/appmap.

III. Creating the test table:

The format of the test table is a 3 level architecture. The 3 levels consits of following files respectively.
1.First level is a .cdd file.
2.Second level consists of one or more .std files.
3.Third level consists of one more .sdd files.


The .cdd file consists of test scenarios. The scenarios are collection of test cases put under .std files. The format of .cdd file is as follows:
Cmd   ScenarioName

For our Opening a new file example the .cdd file may look like as follows:
;Cmd  ScenarioName
T    file-handling

; is used to comment the line
This forms our test.cdd file. The scenario 'file-handling' must be saved with the extension .std

The .std file consists of test cases. The test steps for each test case of .std files are documented in .sdd files. The format of .std file is similar to .cdd file but we put test cases in place of scenarios. The format is as follows:
Cmd   TestCaseName

In our Opening a new file example the .cdd file contains a scenario (file-handling.std). Now the 'file-handling' scenario may look like as follows:
;Cmd  TestCaseName  ^argumentvariable=Value
T    open-new-file

; is used to comment the line and argumentvariable is an optional column
This forms our file-handling.std file. The TestCase 'open-new-file' must be saved with the extension .sdd

The .sdd file consists of the actual test steps. The format of .sdd file is as follows:
Cmd   WindowName    ObjectName        Action        Arguments
For our Opening a New file example the .sdd file may look like as follows:
;Cmd  WindowName    ObjectName    Action        Arguments
T        gedit      gedit          selectMenuItem     mnuFile;mnuNew

; is used to comment the line
here arguments column is optional
This forms our open-new-file.sdd file.

IV. Running the test case through LDTP

1. Extract the LDTP src in a specific folder.
    This will create three sub-folders. input, src and server.

2. Copy the appmap.map from appmap folder to ldtp/input.

3.Make sure that all the .cdd, .std and .sdd files are in input folder.

4. Run the server.
    Open a new terminal and change directory to /ldtp/server/ and run the following command
    ./server.py
     Python must be installed in your server. Otherwise refer to software requirements in downloads sections.

5. Run the LDTP framework.
    Run gedit. (from menu or terminal)
    Open a new terminal and change directory to /ldtp/src/ and run the following command.
    ./ldtp  ApplicationName  sanity
   For our example it is as follows:
   ./ldtp gedit sanity
    Debug messages will be printed and you will see a new file "untitled 1" is getting opened. Otherwise, check once again whether you have done all the steps properly. If yes,    and still not working call for help through mail or IRC. (#ldtp in gimpnet)