[Sugar-devel] Unit tests in Sugar HTML

Daniel Narvaez dwnarvaez at gmail.com
Mon May 13 10:42:14 EDT 2013


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.

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

> 2013/5/13 Manuel Quiñones <manuq at laptop.org <javascript:;>>:
> > Hello,
> >
> > As I am currently implementing sugar palettes in HTML, I want to get
> > the logic right, so I need unit tests.  Then I started to investigate
> > unit testing in javascript.
> >
> > After looking for a bit, I decided to give a try to Jasmine framework,
> > which is AngularJS choice.
> >
> > http://pivotal.github.io/jasmine/
> >
> > My first attempt was running the tests in the command line with
> jasmine-node.
> >
> > https://github.com/mhevery/jasmine-node
> >
> > But soon I realized that testing without access to the DOM is very
> > limited.  For example, a palette needs to add a <div> to the document.
> >  And my second test failed in jasmine-node because of that.
> >
> > So I went for Karma (previously named Testacular).
> >
> > http://karma-runner.github.io/
> >
> > It was easy to configure using RequireJS like is documented in:
> >
> > http://karma-runner.github.io/0.8/plus/RequireJS.html
> >
> > And it works!  You can try installing Karma (npm install -g karma) and
> > then checking out in my clockjs activity.
> >
> > git checkout git://github.com/manuq/clockjs.git
> > cd clockjs/lib/sugar-html-graphics
> > karma start
> >
> > And then point a browser to the URL in the output, which points to Karma
> server.
> >
> > --
> > .. manuq ..
>
> Forgot to point you to my current testing spec, so you can see how
> Jasmine tests look:
>
>
> https://github.com/manuq/clockjs/blob/master/lib/sugar-html-graphics/test/paletteSpec.js
>
> --
> .. manuq ..
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org <javascript:;>
> http://lists.sugarlabs.org/listinfo/sugar-devel
>


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


More information about the Sugar-devel mailing list