|
Lately, I've been doing a lot of performance-related hacking on LDTP. Mostly in the memory area, though some of the
things I've done definitely helped out in the speed department as well. While I've mostly been using LDTP to validate
the support for Accessible properties on widgets in applications, it's also a very good tool for doing automated
performance testing on apps as well. Especially in the case of profiling, where you need to do the same things over
and over repeatedly. It is also good for running apps under valgrind, as you can script to go through every possible
transaction in the UI that might occur, rather than hoping that the normal usage patterns of yourself or someone else
might hit everything. The following script is a quick example I wrote for gnome-background-properites:
#!/usr/bin/python
import string, sys, os
from ldtp import *
from ldtputils import *
from A11yTestUtils import *
program_name = 'gnome-background-properties'
window_title = 'Desktop Background Preferences'
ldtp.setlocale ('en_US.UTF-8')
cwd = os.getcwd ()
launchapp ('valgrind --leak-check=full --log-file-exactly=' + cwd + '/' + program_name + '.valgrind ' + program_name)
time.sleep (40)
guiexist (window_title)
click (window_title, 'btnAddWallpaper')
time.sleep (20)
settextvalue ('dlgAddWallpaper', 'txtLocation', '/usr/share/wallpapers')
click ('dlgAddWallpaper', 'btnOpen')
if (objectexist (window_title, 'btnClose')):
click (window_title, 'btnClose')
else:
click (window_title, 'btnFinish')
The cwd hack is necessary so that we write the script out somewhere discoverable, and the sleep calls are needed, as
LDTP can handle the API calls over the wire much faster than the app running under valgrind is going to be getting them
fromt the Accessibility framework. The script could use a little more work, but it's a good example of how simple it is
to write a script with LDTP to valgrind an application automatically. Enjoy, and start writing your own test scripts, so
we can make the desktop perform as well as it looks.
|