|
|
| (17 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] |
| | |
| __TOC__
| |
| | |
| 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 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.
| |
| | |
| == 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}}).
| |
| | |
| == Developing xpcshell tests within MailNews ==
| |
| | |
| When developing new tests it is useful to look at the [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_.* This list links the existing tests] that are currently within Thunderbird.
| |
| | |
| The review policy for tests is [[MailNews:Automated_Testing#Rules_and_Review_Policy|located here]].
| |
| | |
| === MailNews xpcshell test facilities ===
| |
| | |
| Once {{bug|432812}} is checked in, each existing directory where tests are run will have head_*.js and tail_*.js files that will provide the following by importing core scripts:
| |
| | |
| * A global variable "profileDir" containing an nsIFile variable with the profile directory to use for the xpcshell tests.
| |
| * A nsIDirectoryService that points at the profileDir and provides the necessary facilities to use profile-related directories, e.g. NS_GetSystemDirectory("MailD", ...).
| |
| * Automatic cleanup of the profile directory
| |
| ** This is important so that the results of one test do not affect the results of another and the redundant data gets deleted (for developers running tests).
| |
| | |
| == Guidelines for new tests ==
| |
| | |
| These guidelines are intended to provide some level of consistency across the MailNews tests.
| |
| | |
| === New Directories for tests ===
| |
| | |
| * New directories should be created as test/unit under whichever directory they apply, e.g. tests directly relating to the address book go into mailnews/addrbook/test/unit.
| |
| * All new directories should have a head_*.js and a tail_*.js file, these should import some of the core mailnews scripts.
| |
| ** ''These changes haven't been checked in yet, see {{bug|432812}}''
| |
| | |
| === New Tests ===
| |
| | |
| * The test name should be relevant to the class/action the bug is testing, or the bug number of the bug it is checking that it fixes.
| |
| * Where the profile directory is required, use profileDir that is automatically created in [http://mxr.mozilla.org/seamonkey/source/mailnews/test/resources/mailDirService.js mailDirService.js]
| |
| | |
| == Coming soon ==
| |
| | |
| * {{Bug|421050}} Import tests for mailnews/import
| |
| ** Will fix some aspects of creating local folders, actually allowing testing of these to be incorporated in xpcshell tests.
| |
| ** First version of tests for Mail.app import testing.
| |
| * {{Bug|413077}} Fake server testing scheme for mailnews
| |
| ** First version implements basic news server.
| |
| | |
| == Problems running core xpcshell tests on MailNews ==
| |
| | |
| See [[MailNews:Automated_Testing#xpcshell_tests]] for the list of current problems.
| |
| | |
| == 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]
| |