MailNews:Xpcshell tests: Difference between revisions

Jump to navigation Jump to search
→‎MailNews xpcshell test facilities: Update with curent information on profile directories
(Drop the comming soon section, we have those or at least the initial fixes and we won't keep it up to date once we get it going.)
(→‎MailNews xpcshell test facilities: Update with curent information on profile directories)
Line 25: Line 25:
=== MailNews xpcshell test facilities ===
=== MailNews xpcshell test facilities ===


Each existing unit test directory has head_*.js and tail_*.js files that provide the following by importing core scripts:
Each existing unit test directory has a head_*.js file that provides 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 global variable "gProfileDir" 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", ...).
* A nsIDirectoryService that points at the gProfileDir 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).
=== Profile Directory Cleanup ===
 
The xpcshell tests do not run in a standard profile directory. The mailnews xpcshell test facilities provide a specific directory for its tests:
 
<pre>
<objdir>/_tests/mailtest/
</pre>
 
This directory is emptied and re-created before each test is run. This means that when running a test with SOLO_FILE and check-one or check-interactive, the directory is left in place to aid debugging.


== Guidelines for new tests ==
== Guidelines for new tests ==
canmove, Confirmed users, Bureaucrats and Sysops emeriti
3,628

edits

Navigation menu