Željko Filipin's Blog on Software and Testing

Test like you do not need the money.

Archive for the ‘E-mail’ Category

Testing E-mail: The Code

without comments

Lately I have been testing e-mail functionality of web application. This is the fifth post about that experience. Last week I wrote about lessons learned.

I have written a little framework that helps me with testing e-mail.

To use it, you will have to install Ruby, Tmail and SMTP server.

Then download mail.zip (2,20 KB) and extract it. No installation required. There are even some unit tests (unit_tests.rb) and example code (usage.rb).

Send mail.

SendMail.new(
  "user@domain",
  "application@domain",
  "title",
  "body").send

Check if application sent mail that you have expected.

Mail.received?(
  [Mail.new(
    "application@domain",
    "user@domain",
    "title")])

For now, mail that is sent can only contain from, to, subject and body. While receiving, I only check from, to and subject.

This is code that I am really using every day.

Please understand that I am a tester, not a developer, and I know that this code could be better. Feel free to improve it. Post bug reports and your comments here.

Written by Željko Filipin

February 7th, 2007 at 6:12 pm

Posted in E-mail

Testing E-mail: Lessons Learned

with one comment

Lately I have been testing e-mail functionality of web application. This is the fourth post about that experience. Last week I wrote about tools I use for e-mail testing.

I suggest that you start with little steps, and I mean really little steps.

I assume that you have a test suite that tests web interface of your application. Some tests cause e-mails to be sent. But, until now, you have ignored that e-mails.

First, check if your application sends correct number of mails (see, really little steps). For example, if you are testing forum application, after start a discussion test is performed, check if every member of forum gets e-mail (depending on each member’s settings).

Then, after you have checked number of e-mails after all your tests, start checking if e-mail headers (from, to, subject) are correct for every mail that is sent. After that is done, start checking body, and then attachments.

I think it is better to test only some properties of e-mail but for larger number of e-mails, than testing all properties of e-mail, but for small number of e-mails.

Of course, this is only my advice based on my recent experience. Adjust your tests to your context.

Written by Željko Filipin

January 30th, 2007 at 5:58 pm

Posted in E-mail

Testing E-mail: Tools

with one comment

Lately I have been testing e-mail functionality of one application. In the beginning I though that I would write two or three posts about that experience. Now I think there will be more, but not much more. I prefer more shorter articles that two or three longer ones. I am all about little steps, as you will shortly see.

This is the third article. Last week I wrote a little introduction and how to install SMTP server.

As I wrote the last year, when testing e-mail, I am using Ruby and this Ruby libraries:

  • receive e-mail – Net::POP3
  • send e-mail – Net::SMTP
  • create (before sending) and parse e-mail (after receiving) – TMail

Written by Željko Filipin

January 22nd, 2007 at 7:09 pm

Posted in E-mail