Closed
Bug 405147
Opened 17 years ago
Closed 17 years ago
Provide some basic unit tests for nsIAbDirectory
Categories
(MailNews Core :: Address Book, defect)
MailNews Core
Address Book
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: standard8, Assigned: standard8)
Details
Attachments
(1 file, 1 obsolete file)
10.82 KB,
patch
|
standard8
:
review+
Bienvenu
:
superreview+
|
Details | Diff | Splinter Review |
It was suggested to me over irc that we should start to put together unit tests for mailnews. It is a complex bit of code and automated tests should help us to catch more problems as soon as they are checked in. As the address book is the simplest as most of it doesn't require protocols or mailboxes/complex settings, it was suggested that its the best place to start. So I've put together some basic tests for attributes in nsIAbDirectory and some functions. It doesn't cover everything, and I've already found one bug/misleading functionality from trying things out (which I'll look at fixing in a later bug). So, attaching patch for the first address book tests. I've put these under mailnews/addrbook/test - I think this is the best place for address book specific items. Other tests we can do things like mailnews/local/test or mailnews/imap/test, unless they happen to be global, in which case we could always do mailnews/test. SeaMonkey Linux trunk will test these as soon as they are checked in, we'll have to pick a box(es) for Thunderbird (Linux?) and enable them there as well with a separate bug. Not sure what our review policy will be for tests, but for now sticking with r and sr and doing one rep from SM & one from TB.
Attachment #289956 -
Flags: superreview?(bienvenu)
Attachment #289956 -
Flags: review?(neil)
Comment 1•17 years ago
|
||
Comment on attachment 289956 [details] [diff] [review] Basic Unit Tests for Address Book >+ if (prop == NS_APP_USER_PROFILE_50_DIR) { >+ return dirSvc.get("CurProcD", Ci.nsIFile); >+ } Wouldn't it be cleaner to make a dummy subfolder? >+var abs = [ kPABData.fileName, >+ kCABData.fileName]; Nit: Inconsistent spacing. >+ do_check_eq(AB.getIntValue("inttest", 12345, -1), 12345); The extra 12345 looks wrong here. r=me with that fixed.
Attachment #289956 -
Flags: review?(neil) → review+
Assignee | ||
Comment 2•17 years ago
|
||
Updated to address Neil's comments. The address book files will now get loaded from/saved to an "addrbook" folder under the main process directory (typically dist/bin) and the directory will be recursively removed after the tests.
Attachment #289956 -
Attachment is obsolete: true
Attachment #290130 -
Flags: superreview?(bienvenu)
Attachment #290130 -
Flags: review+
Attachment #289956 -
Flags: superreview?(bienvenu)
Comment 3•17 years ago
|
||
Comment on attachment 290130 [details] [diff] [review] Basic Unit Tests for Address Book v2 cool, thx for working on this, Mark.
Attachment #290130 -
Flags: superreview?(bienvenu) → superreview+
Assignee | ||
Comment 4•17 years ago
|
||
I've now checked the unit test in and it passes on SeaMonkey Linux which is the only place we're running it at the moment. I've raised bug 406227 to cover enabling of Unit tests on a Thunderbird box.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Are there any special build flags for building TB with tests enabled? I would assume that "ac_add_options --enable-debug" needs to go into the mozconfig, but are the other flags that are useful or interesting? Perhaps an example with tests enabled can be added to http://developer.mozilla.org/en/docs/Configuring_Build_Options. FYI, a while back I investigated using some automation to test TB. I think part of this needs to be a mail server, somehow. Nobody should be asked to test mail against their own mail archive. One can, however, use automation to set up a local server, put a bunch of mail into different accounts and then have TB come up, fetch the mail, and then do stuff with it. I blogged about this at http://xoatlicue.blogspot.com/2007/01/testing-thunderbird-as-standalone.html. If anyone has questions or suggestions, feel free to ask.
Assignee | ||
Comment 6•17 years ago
|
||
(In reply to comment #5) > Are there any special build flags for building TB with tests enabled? I would > assume that "ac_add_options --enable-debug" needs to go into the mozconfig, but > are the other flags that are useful or interesting? Perhaps an example with > tests enabled can be added to > http://developer.mozilla.org/en/docs/Configuring_Build_Options. From the Configuring Build Options page: --- ac_add_options --disable-tests By default, many auxiliary test applications are built, which can help debug and patch the mozilla source. Disabling these tests can speed build time and reduce disk space considerably. --- So, just remove --disable-tests and you've got them... > FYI, a while back I investigated using some automation to test TB. I think part > of this needs to be a mail server, somehow. Nobody should be asked to test mail > against their own mail archive. One can, however, use automation to set up a > local server, put a bunch of mail into different accounts and then have TB come > up, fetch the mail, and then do stuff with it. I blogged about this at > http://xoatlicue.blogspot.com/2007/01/testing-thunderbird-as-standalone.html. > > If anyone has questions or suggestions, feel free to ask. This discussion would be more appropriate on the mozilla.dev.apps.thunderbird/seamonkey newsgroups. However initially we're just getting some basic testing in place. Protocol tests will follow but we need to work out the mechanism. http://developer.mozilla.org/en/docs/Mozilla_automated_testing has information on the current types of tests, one of them does include a http server already. I haven't investigated that, but it would be worth it as a first look. Another item I noticed is that tinderboxes used to have a method for perf testing displaying messages, we may be able to base something around that. However like I've already said, this is a dicussion for the newsgroups and not bugzilla.
Assignee | ||
Updated•17 years ago
|
Flags: in-testsuite+
Updated•16 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•