[Sugar-devel] Unit testing an activity

James Cameron quozl at laptop.org
Thu May 3 18:56:32 EDT 2012


I have not seen any activity with unit tests.

I have seen and maintained Python code with tests that are implemented
as conditional blocks at the end of each source file except the main
source file.  These conditional blocks are predicated on execution of
the file alone, and not on import.  The main source file was in the
directory above, with all the imported files in a directory below.

So running the tests was:

	for x in directory/*/py; do python $x; done

However, since most source files in a Sugar activity tend to depend on
GTK+ or Sugar, this approach is not as useful.  This approach can be
used for the model third of the model view controller style.

Taylor, sugar-launch can be used to launch an activity in a testing
environment, but scripted control of the launched activity is your next
challenge.

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list