GNOME Bugzilla – Bug 321628
Create unit tests for dogtail (and pyspi?)
Last modified: 2011-02-07 06:01:39 UTC
Currently we don't have any unit tests for checking that the framework is sane. I think we badly need to have these, and we should run them whenever we're about to commit to CVS, and not commit until the tests pass. Proposal: Create a simple app using pygtk and libglade, which exists purely for the sake of running unit tests on the dogtail and pyspi API. It would live in a subdirectory of the toplevel dogtail directory. We'd use the standard Python "unittest" module, in the setup/teardown we'd run the app, we can then have tests which drive the various methods in the API, checking that searches succeed, that they fail where they should fail etc etc. Possible names for the dummy app: - treestump - hydrant (too US-specific?) - lamppost (too UK-specific?) - tree (No: already taken) Should the dummy app live in the dogtail module? Pros: ensures the visibility of it, makes it easy to run the unit tests Cons: it could also be useful for writing unit tests for pyspi Even without pyspi unit tests, if making changes to _pyspi_ I think we should run the _dogtail_ unit tests and see if anything breaks there (this isn't strictly doing unit tests for pyspi, but should catch any major breakages); perhaps we should have proper pyspi unit tests as well. Thoughts?
Much simpler: use gtk-demo, which is shipped with the GTK package (on Fedora, at least, and ought to be by any sane distribution) I've written the start of some unit tests. At first I implemented them inline near the code they tested, but decided to move them out into a new file devoted to the tests, based on the advice at the bottom of: http://docs.python.org/lib/organizing-tests.html
Created attachment 67894 [details] New file, to go in dogtail/dogtail. Framework for dogtail unit tests, with 36 tests so far,of which about 15 are meaningful, the rest are FIXMEs.
Odd, I can't see gtk-demo via at-spi.
Oh yeah; I'm on FC5. Did you write these on rawhide?
Oh, it looks like on FC5 gtk-demo needs the GTK_MODULES="gail:atk-bridge" hack. Maybe utils.run() should do that for you...
I committed a version of the attachment in a new subdirectory as: tests/Node.py Further files can be created, containing tests for other classes. So this is partially working - we don't have great test coverage yet though.
dogtail development has been stalled and it has been unmaintained for a few years now. Maintainers don't have future development plan so i am closing bugs as WONTFIX. Please feel free to reopen the bugs in future if anyone takes the responsibility for active development.