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 <[EMAIL PROTECTED]> 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
[email protected]
http://mozdev.org/mailman/listinfo/project_owners

_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to