Linux Desktop Testing Project editor
A nice post by Hari, Thanks for your nice post.
Want to use LDTP to test your application? Or do you want to automate the actions you do often? Or are you a GNU/Linux user who want to show “magic” to your friends by recording your actions and playing them back? You can use LDTP for this. But one small issue with LDTP is that you should know the LDTP Python API to write any test suite. But with the new LDTP Editor, this makes your job really simple. A screenshot of the LDTP Editor is shown below.
This is a simple HOWTO for recording and playing back the recorded script.
Installing LDTP.
- Download the lastest LDTP source code from http://people.freedesktop.org/~nagappan/ldtp-0.9.2.tar.gz.
- Uncompress the file.
- Compile the code using ./configure and make
- If you don’t have the access to install softwares, run the ldtpeditor file in the python folder
- If you have access to install softwares, then run “make install”
Note:: After installing LDTP Editor, i when i tried to run ldtpeditor, got an error saying
hari@hari-laptop:~/ldtp/ldtp-0.9.2$ ldtpeditor
(ldtpeditor:11130): libglade-WARNING **: could not find glade file '/usr/share/local/ldtp/glade/ldtpeditor.glade'
Glade file not found
The ldtpeditor.glade file is present in the python folder. I got this error because i compiled the code as ./configure. If i had done it as ‘./configure –prefix=/usr’, then i wouldn’t have got this error. Anyway i copied the file manually to that folder.
hari@hari-laptop:~/ldtp/ldtp-0.9.2$ sudo mkdir -p /usr/share/local/ldtp/glade/
hari@hari-laptop:~/ldtp/ldtp-0.9.2$ sudo cp python/ldtpeditor.glade /usr/share/local/ldtp/glade/
hari@hari-laptop:~/ldtp/ldtp-0.9.2$ ldtpeditor
After that when i ran ldtpeditor, it ran without any issues.
Recording using LDTP Editor
For this let us consider recording the actions performed in gcalctool.
- First make sure Assistive Technology is enabled in your desktop. If you are not sure about this, open gnome-control-center and in that open Assistive Technology Preferences. You should have Enable Assistive Technologies checked to use LDTP.
- If you are enabling Assistive Technology only now, logout and login again.
- Run ldtpeditor and gcalctool.
- Make sure both you have enabled ‘Always on Top’ or both the applications and both the window doesn’t overlap with each other.
- Click the Start button the LDTP Editor. All actions performed after this are recorded.
- Perform actions in the gcalctool. Check out this video to see the actions i recored in my computer .
- After you’re done with the actions in the gcalctool, click the Stop button in the LDTP Editor.
- You can see that the ‘Recorded Code’ tab is updated with code as when you perform actions in gcalctool.
- Click the convert button in the LDTP Editor. You’ll see that the Generated LDTP Code and Generated LDTP XML tabs are filled with generated code.
- The Play button is not working now. I wrote the patch for that yesterday night ;-).
- Save the contents of the ‘Generated LDTP Code’ into a python file (for ex frisco.py) . Note that if the file name you specify already exists, then it OVERWRITES the filename without any warning.
- Then run
hari@hari-laptop:~$ python frisco.py
- The actions you performed while recording will be played back again :-)
Currently the Play button in the LDTP Editor is not enabled. But you can make it work by applying the patch mentioned below. I guess this patch will be added to LDTP Editor in a week or so. So check the ChangeLog file before applying the patch.
LDTP Editor Preferences
Using the LDTP Prefereces, you can control what all actions you can control. A brief summary about the options given in the Preferences window.
- Listen key events
This option is not yet implemented. Checking/Unchecking this doesn’t make any difference now. - Listen mouse events
This option is not yet implemented. Checking/Unchecking this doesn’t make any difference now. - Generate LDTP Code
Only when if this option is enabled, Convert will generated to LDTP code in the ‘Generated LDTP Code’ tab. This is enabled by default when you run LDTP Editor. - Generate Data XML
If this option is enabled, the LDTP Editor will generate data XML for the actions you perform. - Generate keyboard events code
Generates code for the keyboard events you performed during the recording session. - Generate wait time code
Calculates the delay one takes between each action during the recording session and generates code so that similar time delay is generated while play back. - Generate Memory / CPU statistics.
The code to generate Memory and CPU statistics will be generated. You need to install pystatgrab and libstatgrab packages.
Patching to make the Run button work
- Copy this patch file to your ldtp folder.
- Run
hari@hari-laptop:~/ldtp/ldtp-0.9.2$ cd ldtp-0.9.2
hari@hari-laptop:~/ldtp/ldtp-0.9.2$ patch -p0 <> - Compile the code again and run ldtpeditor. This time after you Convert the Code, you can Run the code from the LDTP Editor. :-)
Note:: The generated code had many unwanted waittillguiexist. I saw waittillguiexist(”dlg0″) in many places. If your playback is stopped because of this, remove that before running the scripts.
Sometime the resource will go high as the application map info is collected from the application, so no need to worry.
If you find any issues regarding LDTP Editor, report it to ldtp-dev@lists.freedesktop.org or nagappan@gmail.com or sp2hari@gmail.com
All patches are welcome. :-)
My comments:
You can use ./configure --prefix=/usr to avoid that glade file missing warning.
Additional notes:
* After clicking record click 'Convert' to get the code converted in LDTP format (It does some post processing, so its required)
* Click save button to save generated python script, if 2nd tab is empty, then it will try to get the contents of first tab and store it in the file you specify. If file already exist, it will *OVER-WRITE*
* control+c, control+v doesn't work
* Sometime the resource will go high as the application map info is collected from the application, so no need to worry. With Thunderbird, the recording really sucks
* You need to have GNOME 2.14 and above to use LDTP editor
3 Comments:
hi
ldtp is ultimate tool
but i am not able to use ldtp editor that make me hard to identify the objects of any program, and rewrite the script.
i saw some where ldtp recorder is coming up. when we can expect.
Or is there any way to get (retrieve) the objects of the GUI program based on QT.
Regrads,
Setu Gupta
Hi Nagappan
hats off for your work
but i am not able to see the ldtp editor
in 2.3 version. is there any alternative to record (grab the object names of) QT application.
Regards
Setu Gupta
Setu, Unfortunately LDTP editor support have been stopped due to many accessibility issues. You can use accerciser app on Linux to look at the UI widgets that are accessible. In LDTP you can use getobjectlist, getobjectinfo, getobjectproperty APIs. Thanks
Post a Comment
<< Home