jpcamara
jpcamara

Reputation: 682

Unit Testing a Firefox Addon

In working on a firefox addon, i've found the task of unit testing to be kinda janky and difficult to setup. Anyone have recommendations on how to setup unit tests for an addon? Any tools or additional addons found to be helpful?

I've found Mozmill [ https://addons.mozilla.org/en-US/firefox/addon/9018 ], which I think will be useful to an extent, but it's more of a high level tool and i'm looking for a tool or approach that works for more low level testing.

Upvotes: 14

Views: 2135

Answers (5)

studgeek
studgeek

Reputation: 14920

The new JetPack Add-On SDK they are working on for Firefox 4.0 has testing built in. It isn't documented yet though, but it's something to watch. It looks like you run "cfx test" which will run the tests.

Some links: JetPack - https://jetpack.mozillalabs.com/ Add-On SDK Documentation - https://jetpack.mozillalabs.com/sdk/1.0b2/docs/ Add-On SDK Test Harness - https://builder.addons.mozilla.org/api/test-harness

Upvotes: 2

studgeek
studgeek

Reputation: 14920

Also see http://paulgu.com/wiki/Unit_Testing_Framework. I haven't used it, but it seems like a simpler and lighter-weight approach that might be easier to integrate. I think it could be better packaged to make it easier to add to an existing extension, but that is probably a straightforward refactoring.

Upvotes: 1

Oleg Mazko
Oleg Mazko

Reputation: 1830

I used code-level unit testing with Mozmill. I "hooked" resource:// path of Mozmill by programmatically adding testing add-on (Urim) path to it in test initialization (setupModule function). As the result i can test any peace of code of my testing add-on like it is own code of Mozmill. Look here for an example. As i understand, this is you are looking for.

Upvotes: 3

Dominik
Dominik

Reputation: 1202

How about UxU ( https://addons.mozilla.org/en-US/firefox/addon/6357 ) ?

Upvotes: 5

dmazzoni
dmazzoni

Reputation: 13256

WebDriver or Selenium?

Upvotes: 0

Related Questions