|
|
(21 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| <small>[[MailNews:Automated Testing|<< Back to MailNews:Automated Testing]]</small>
| | Content moved to the Mozilla Developer Center [http://developer.mozilla.org/en/MailNews_xpcshell-tests http://developer.mozilla.org/en/MailNews_xpcshell-tests] |
| | |
| The xpcshell unit tests are probably the easiest test to write, requiring no UI and being written in javascript. They are very useful for testing interfaces and back-end functionality.
| |
| | |
| MailNews has a growing set of xpcshell tests. Developers and contributors should consider adding tests within MailNews where possible.
| |
| | |
| == xpcshell tests within MailNews ==
| |
| | |
| xpcshell tests can be run in a variety of different ways, the [http://developer.mozilla.org/en/docs/Writing_xpcshell-based_unit_tests devmo wiki page] describes these best.
| |
| | |
| When developing new tests it is useful to look at cumentation for writing xpcshell-based unit tests]
| |
| * [http://mxr.mozilla.org/seamonkey/find?text=&kind=text&string=%2Fmailnews%2F.*test_.* existing tests] and also the various support frameworks that have been written:
| |
| | |
| * [http://mxr.mozilla.org/seamonkey/source/mailnews/test/resources/mailDirService.js mailDirService.js]
| |
| ** Provides: an nsIDirectoryServiceProvider implementation which ensures that the user "profile" directory is defined for xpcshell test implementations.
| |
| ** "Profile" Directory exists in the directory of the executable, it is called "mailtest"
| |
| ** Can be imported via [http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/mailnews/compose/test/unit/test_nsMsgCompose1.js&rev=1.4&mark=6 do_import_script]
| |
| ** Should be used to provide a profile directory for all MailNews tests.
| |
| * [http://mxr.mozilla.org/seamonkey/source/mailnews/addrbook/test/resources/abSetup.js abSetup.js]
| |
| ** Provides: Initial setup information for the default address books
| |
| * [http://mxr.mozilla.org/seamonkey/source/mailnews/addrbook/test/resources/abCleanup.js abCleanup.js]
| |
| ** Provides: cleanup() function used to correctly close down all address books and remove the created files.
| |
| ** Notes: release temporary variables before this function so that the garbage collector can clean up nicely (otherwise windows tests may break).
| |
| | |
| == xpcshell test reporting ==
| |
| | |
| These currently run on the [http://tinderbox.mozilla.org/SeaMonkey/ SeaMonkey tinderboxes], and report as TUnit. Thunderbird hopes to pick running of these up soon ({{bug|422817}}).
| |
| | |
| == Useful Links ==
| |
| | |
| * [http://developer.mozilla.org/en/docs/Writing_xpcshell-based_unit_tests devmo documentation for writing xpcshell-based unit tests]
| |
| * [http://mxr.mozilla.org/seamonkey/find?text=&kind=text&string=%2Fmailnews%2F.*test_.* Current MailNews unit tests]
| |