1
edit
Changes
→How to add test cases by using this framework
=== How to add test cases by using this framework ===
Writing the test cases by using this framework is really easy. All you need to to is opening the file '''unittesting.js''', and add any type of test case by adding following three sectionssetps. (This example is for bookmarks unit testing)
<pre>
*
* In this part, you need to initialize the services that contains all the units
* * EXAMPLE: initialize This is an example for Bookmark Service * this._RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); * this._kBMSVCIID = Components.interfaces.nsIBookmarksService; * this._BMDS = this._RDF.GetDataSource("rdf:bookmarks"); * this._BMSVC = this._BMDS.QueryInterface(this._kBMSVCIID);Services
*
---------------------------------------------------------------------------*/
* bookmark test window initialization
*
* setUp is for initializing services in the firefox API
*
---------------------------------------------------------------------------*/
var bookmarkstestWindow = {
logText("Unit Testing Window startup");
this.bookmarksTests = new BookmarksTests(); // initialize bookmark unit tests
this.testsRun = new Array();
logText("finished unit testing startup");
}
};
*
---------------------------------------------------------------------------*/
window.addEventListener("load", bookmarkstestWindow.setUpinitialize, false);
</pre>