[Sugar-devel] Unit tests in Sugar HTML

Daniel Narvaez dwnarvaez at gmail.com
Mon May 13 19:58:32 EDT 2013


On Monday, 13 May 2013, Manuel Quiñones wrote:

> 2013/5/13 Daniel Narvaez <dwnarvaez at gmail.com <javascript:;>>:
> > I'm on a phone so I have not yet taken a proper look. Though it looks
> pretty
> > cool. It seems to have custom browsers support, so it should be easy to
> run
> > it in sugar-html-activity.
> >
> > We can look at hooking this up in sugar-build/buildbot, it should not be
> a
> > lot of work.
> >
> > I suppose it should work for the libraries too if we just put some HTML
> in
> > the test dir.
>
> Yes the idea is to add unit tests in each of our libraries.  I did it
> in lib/sugar-html-graphics inside clockjs code to get a first
> impression, but I will move it to sugar-html-graphics repository if we
> agree using Jasmine.


Maybe a quick comparison with mocha (used by firefox os) would be worth it,
since karma can run mocha tests too. I wouldnt spend too much time on it
though.


>
> So the proposal would be:
>
> - start writting unit tests with Jasmine framework


Yes!


> - add a command to sugar-build to run the tests with Karma


Yeah, we can use the check command and run karma for the js modules.


> - automate tests adding Karma to buildbot
>

Which should just work if we use the check command.

Something else I would like to provide is a way to take screen snapshots.
The tests could request the webview to generate a snapshot with a certain
id (we could use an alert with a well known text, in lack of a better
communication mecanism, could be done more cleanly with a plugin but
probably not worth it for tests). At the end of test run, the runner would
compare the snapshots with those in test/snapshot and complain about
differences. It's trivial to implement and should be pretty useful for
testing visual stuff.


-- 
Daniel Narvaez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130514/ce5a2590/attachment.html>


More information about the Sugar-devel mailing list