Way of the Monkey
November 2006
S M T W T F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
Donate!
Projects
Tango Portfolio
Cool People
Anna Dirks
Andreas Nilsson
Andy Fitzsimmon
Frédéric Bellaiche
Hylke Bons
Jakub Steiner
Josef Vybiral
Olivier Charavel
Ryan Collier
Sebastian Kraft
Simon Pascal Klein
Steven Garrity
Tuomas Kuosmanen
Vinicius Depizzol
Recent Music
Performance Automation Wed, 22 Nov 2006 16:27:24 -0500

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.




Ninja Monkey icon based on face-monkey icon from The Tango Project