Add more serious testing #101
Labels
good first issue
Good for newcomers
help wanted
Extra attention is needed
tombstone
A reference to an old issue on mattnenterprise/rust-imap
A fellow tester! How exciting! Welcome!
Since #102, the
imap
crate gained the ability to run full IMAP integration tests against a "real" IMAP server (GreenMail) running in a Docker container. That server supports both SMTP (for sending mail) and IMAP (for receiving them), and is particularly well suited for testing as it automatically creates accounts as they are accessed.While
imap
already has a few integration tests intests/
, they are, at the time of writing, fairly rudimentary. We can do better. And you can help! And hey, if you add tests, you may also be able to improve the code coverage and make the @codecov-io bot happy!Inspiration
In general, you can never have too much testing, especially for a crate like
imap
which has to interact with "the real world", which often misbehaves in various odd ways. Here are a few ways you can help expandimap
's testing story:Net::IMAP
imap::client
node-imap
Mail::IMAPClient
imaptest
scripted testsWriting tests
Integration tests for
imap
are super easy to write, and generally they all follow the same basic recipe. Uselettre
to send some e-mails, andimap
to create mailboxes, move e-mails, expunge, delete, store, append, list, and whatever else you may feel like doing. Thesession
andsmpt
helper functions give you authenticated clients forimap
andlettre
respectively. It looks something like thisIf you want something more substantial to look at, the
inbox_uid
integration test is probably a good place to start.To ensure that we can run multiple tests in parallel, you should make sure that each test you write uses a dedicated user account (e-mail address) GreenMail will automatically create accounts for new e-mail addresses it sees, so all you should need to do is to decide how to name them (the name of the test +
@localhost
is probably a good choice). You'll also want to do cleanup at the end of your test so that we can run the same test more than once without restarting the server!What now?
Go write some tests and submit a pull request :D
You're awesome!
This issue originally resided in mattnenterprise/rust-imap#101.
The text was updated successfully, but these errors were encountered: