Unit Testing a Firefox Addon
Asked Answered
F

5

14

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.

Footpad answered 31/12, 2009 at 3:50 Comment(0)
C
5

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

Croatian answered 5/2, 2010 at 17:4 Comment(1)
that looks exactly like what i'm looking for! thanks for your help!Footpad
A
3

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.

Alessandro answered 7/9, 2010 at 10:44 Comment(0)
T
2

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

Twoup answered 14/2, 2011 at 15:25 Comment(0)
T
1

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.

Twoup answered 14/2, 2011 at 14:43 Comment(0)
M
0

WebDriver or Selenium?

Meal answered 31/12, 2009 at 5:22 Comment(1)
Doesn't really satisfy the unit testing need. The tools mentioned and the one I mention in my question are at a higher level than what i'm looking for. I'm looking for approaches people use for code-level unit testing.Footpad

© 2022 - 2024 — McMap. All rights reserved.