Introduction

The Dumbster is a very simple fake SMTP server designed for unit and system testing applications that send email messages. It responds to all standard SMTP commands but does not deliver messages to the user. The messages are stored within the Dumbster for later extraction and verification.

The Dumbster slots itself very easily into your testing strategy. As long as your application talks to an email server using SMTP then the Dumbster can be used to test the application with no code changes.

The Dumbster is useful in the following scenarios:

The Dumbster is written in Java and is open source. It is distributed under the Apache License 2.0.

Examples

The following is a simple example of how to unit test the email components of your application

public class SimpleSmtpServerTest extends TestCase {
...
  public void testSend() {
    SimpleSmtpServer server = SimpleSmtpServer.start();

    try {
      // Submits an email using javamail to the email server listening on port 25 
      // (method not shown here). Replace this with a call to your app logic.
      sendMessage(25, "sender@here.com", "Test", "Test Body", "receiver@there.com");
    } catch(Exception e) {
      e.printStackTrace();
      fail("Unexpected exception: "+e);
    }

    server.stop();

    assertTrue(server.getReceivedEmailSize() == 1);
    Iterator emailIter = server.getReceivedEmail();
    SmtpMessage email = (SmtpMessage)emailIter.next();
    assertTrue(email.getHeaderValue("Subject").equals("Test"));
    assertTrue(email.getBody().equals("Test Body"));	
  }
...  
}

Download

The Dumbster may be downloaded from the Dumbster SourceForge project page: http://sourceforge.net/projects/dumbster.

Documentation

The JavaDoc is here. The JavaWorld article is here.

Support

Any questions, bug fixes, suggestions should be submitted through the Dumbster forums on the SourceForge project page: http://sourceforge.net/projects/dumbster.

If you would like help with improving your unit testing strategy such as testing "untestable" parts of your code base the author is available on a freelance basis. For further information please contact me (Jason Kitchen) at the following address: consultancy@quintanasoft.com.

Donations

Donations are gratefully accepted and will be used to pay for hosting and beer in that order. They will also bump you to the top of the list for any new features you request.

Another important way you can donate is through reporting bugs, fixing bugs, and development of new features. I have a number of interesting projects for anyone interested in donating time to the project.