SoftwareTesting:Tools:L10n:Coverage
L10n Coverage is an extension to test the Firefox UI and see if any errors show up. Most fatal errors are reported in the Error Console, so watching that will be a good indication of what's going wrong.
The extension provides a basic architecture for running scheduling tasks as well as three classes of tests for menus, preferences, and neterror pages. Those three tests are hooked up to two XUL pages.
Patches and enhancements are always welcome, please file bugs with patches, and CC l10n@.
Contents
Architecture
The architecture consists of an nsITimer, popping items from a stack every time it is triggered. These items can themselves push items on the stack again. The central object here is
Stack = { push: function(aItem) {...}, ... }
The items to be pushed should implement
Item.prototype = { args: [], method: function _m(aArg1, ...) { // This is the method that actually does the work } }
The method is invoked by
obj.method.apply(obj, obj.args);
setting both this and the arguments to the specified values.
If you have asynchronous tasks running, the best way to do this is to push a dummy item on the stack, that adds itself back onto the stack until the asynchronous task is finished. See loadAction in coverage-neterror.js for an example.
Entry points
There are currently two entry XUL pages, coverage.xul running the menu and preferences tests, and neterror-coverage.xul running the neterror tests. The bundling is this way because neterror requires an iframe, and, because those two sets have a similar runtime.
Test categories
There are three kinds of tests, as of now, menus, preferences, and about:neterror pages.
Menus
This test opens the all menus and their child popups from the main menubar, and closes them again.
Preferences
This test opens the preference window, and loads each pane. Parsing errors in a pane will show up in the Error Console.
Network Error Pages
These tests load all error cases available in appstrings.properties in a faked neterror page by plain loading the about:neterror URLs corresponding to that. Passing the right arguments to the formatted strings requires a lot of detail hacking, so right now, all replaceable strings in the short descriptions are actually just replaced with the URL http://foo.bar.