[Project_owners] unit-testing Firefox extensions?

Matthew Sherborne msherborne at gmail.com
Tue Jan 24 22:48:36 EST 2006


To test XUL you'd have to programatically check the DOM, see if your item is
in the right place/menu and try actually clicking it with Javascript and see
that it does what it's surposed to.

Should be pretty easy: (Famous last words)
var ele = getElementById('myid')
assert(ele.nextSibling.caption == 'a caption')
ele.click() // or something

Personally I'm still in the prototyping/framework creation stage and it
seems like a lot of work so I'm not going to bother at the moment.

Blessings
Matthew

On 24/01/06, Matthew Wilson <matthew at mjwilson.demon.co.uk> wrote:
>
> Babak Esfandiari wrote:
> > Hi,
> >
> > Any tips as to how to unit-test Firefox extensions? I know there are a
> > few Javascript unit-testing frameworks around, but how would you use
> > them in the context of a Firefox extension? And would you use any
> > particular development environment for such a task?
>
> I'm just starting to move to doing this for testing of some of my code
> with JSUnit.
>
>
> http://www.mozdev.org/source/browse/annozilla/service/tests/testLocalServer.html?rev=1.1&content-type=text/x-cvsweb-markup
>
> This is for an XPCOM component, so the testing is of the public
> interface. (The testLocalServer function should be split into separate
> functions though.)
>
> How you test depends on what you're testing. You may need to refactor
> your Javascript functions for better testability.
>
> Testing of XUL is much harder of course.
>
> Matthew Wilson
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20060124/926629fb/attachment.htm


More information about the Project_owners mailing list