Running Tests From Extensions

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
(Run Tests From Extensions)
m (Changed code blocks to use syntax highlighting)
 
Line 4: Line 4:
Firebug test harness allows also running tests from all installed extensions at once. This make possible to not only test Firebug itself, but also all installed extensions and possible conflicts among them.
Firebug test harness allows also running tests from all installed extensions at once. This make possible to not only test Firebug itself, but also all installed extensions and possible conflicts among them.
-
In order to automatically load exposed test suites from extensions into the test console you need to write following URL into the FBTest Console's address bar (test list url) and press enter.
+
In order to automatically load exposed test suites from extensions into the test console you need to write following URL into the FBTest Console's address bar (test list url) and press Enter.
<code>fbtest:all</code>
<code>fbtest:all</code>
Line 15: Line 15:
In order to get test-list URLs from installed extensions, the test console dispatches an event to all modules as follows:
In order to get test-list URLs from installed extensions, the test console dispatches an event to all modules as follows:
-
<pre>
+
<source lang="javascript">
var testLists = [];
var testLists = [];
dispatch(Firebug.modules, "onGetTestList", [testLists]);
dispatch(Firebug.modules, "onGetTestList", [testLists]);
-
</pre>
+
</source>
An extension can handle the event and expose its test-list URL:
An extension can handle the event and expose its test-list URL:
-
<pre>
+
<source lang="javascript">
Firebug.FireCookieModule = extend(Firebug.Module,
Firebug.FireCookieModule = extend(Firebug.Module,
{
{
Line 35: Line 35:
}
}
-
</pre>
+
</source>

Latest revision as of 08:50, 18 May 2011

This page explains how to run tests from Firebug extensions.

[edit] Run Tests From Extensions

Firebug test harness allows also running tests from all installed extensions at once. This make possible to not only test Firebug itself, but also all installed extensions and possible conflicts among them.

In order to automatically load exposed test suites from extensions into the test console you need to write following URL into the FBTest Console's address bar (test list url) and press Enter.

fbtest:all

The second option is to right click on the above address bar and pick Load Registered Tests.

As soon as you see all tests loaded (tests from Firebug itself are loaded too), you can press Run All on the toolbar as usual.

[edit] Expose Tests From an Extension

In order to get test-list URLs from installed extensions, the test console dispatches an event to all modules as follows:

var testLists = [];
dispatch(Firebug.modules, "onGetTestList", [testLists]);

An extension can handle the event and expose its test-list URL:

Firebug.FireCookieModule = extend(Firebug.Module,
{
    ...
    onGetTestList: function(testLists)
    {
        testLists.push({
            extension: "Firecookie",
            testListURL: "chrome://firecookie/content/testList.html"
        });
    }
 
}
Personal tools