[Sugar-devel] Unit testing an activity

Walter Bender walter.bender at gmail.com
Thu May 3 21:10:12 EDT 2012


On Thu, May 3, 2012 at 8:14 PM, Taylor Rose (RIT Student)
<tjr1351 at rit.edu> wrote:
> 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...

I think this is what Rafael was trying to suggest. Most activities
write diagnostic info to a log file. This output can be parsed. (It is
found in .sugar/default/logs

-walter
>
> -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/
>
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>



-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org


More information about the Sugar-devel mailing list