Running Firefox tests with extensions installed

When debugging a test, I’ve sometimes found it useful to have access to an extension such as DOM Inspector or Firebug to debug what’s going on with the test.  In the past, you could do this by a bunch of hacks to make sure that you get the extension inside the test profile folder in time so that the test harness doesn’t delete it for you.  But last week I landed a patch which enables you to do this more efficiently.  Here’s how the new setup works:

  1. You should download the extension’s XPI into your current directory.
  2. You should rename it into {addon-ID}.xpi, where addon-ID is the ID of the extension as specified in its install.rdf file.
  3. You should pass the name of the new XPI file to the –install-extension flag which runtests.py and runreftest.py scripts now accept.

For example, if you want to have Firebug when running the mochitest suite, here’s how you should start the suite:

python objdir/_tests/testing/mochitest/runtests.py --install-extension=firebug\@software.joehewitt.com.xpi

Happy debugging!

Posted in Blog Tagged with: , ,