[Sugar-devel] Unit testing an activity

Taylor Rose (RIT Student) tjr1351 at rit.edu
Thu May 3 20:14:54 EDT 2012


James,

using sugar-launch, do you think I could get a hold of any output the
activity writes to stdout? I've been thinking that maybe I could have a
test mode where the activity would run tests internally and report the
results to stdout. The test program would just parse the output then...

-Taylor

On Thu, May 3, 2012 at 3:56 PM, James Cameron <quozl at laptop.org> wrote:

> 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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120503/265cfe96/attachment.html>


More information about the Sugar-devel mailing list