[Webtest] examples of how to test emails?

Tim Pezarro Tim Pezarro" <Tim_Pezarro@pmc-sierra.com
Tue, 19 Apr 2011 12:22:04 -0700


I have been testing email successfully for about 18 months. You need to =
send the mail you wish to test to a mail server that supports POP. There =
is an important work around that you need to use wich is to invoke a url =
prior to the "emailMessageContentFilter" step. Thanks to a John Spann at =
Citrix for helping me with this.

Here is a working example:

<?xml version=3D"1.0"?>
<!DOCTYPE project SYSTEM "../../dtd/Project.dtd">
<project default=3D"ConfirmActivation">
  <target name=3D"ConfirmActivation">
    <webtest name=3D"ConfirmActivation on ${mailserver}">
          <option name=3D"ThrowExceptionOnFailingStatusCode" =
      </config> =20
        <echo message=3D"invoke http url before calling =
emailMessageContentFilter to work around bug with =
        <invoke url=3D"${bastion.prefix}"/>
        <verifyTitle text=3D"PMC-Sierra - Broadband Communications and =
Storage Chips"/>
        <emailSetConfig server=3D"${mailserver}" type=3D"${servertype}"
          password=3D"${mpmc.mail.password}" =
username=3D"${mypmc.mail.username}" delay=3D"5"/>
        <emailStoreMessageId subject=3D"${subject.success}"
        <emailStoreMessageId subject=3D"${subject.success}"
        <echo message=3D"message id is #{message_to_save}" />
        <verifyText text=3D"Thank you for activating your =
www.pmc-sierra.com account" />
        <retry maxcount=3D"10">
          <echo message=3D"find id of first message matching desired =
subject" />
          <emailStoreMessageId subject=3D"${subject.success}"
            property=3D"message_to_delete" messageIndex=3D"0"/>
          <echo message=3D"delete message" />
          <emailDeleteMessage messageId=3D"#{message_to_delete}" />
          <echo message=3D"see if any remain" />
          <emailStoreMessageCount subject=3D"${subject}"
          <verifyProperty name=3D"emailcount" text=3D"0"/>



Tim Pezarro
Manager, Web Services
Corporate Marketing
Phone: +1-604-415-6044
Cell: +1-604-762-1000
Fax: +1-604-415-6602
PMC-Sierra, Inc.
8555 Baxter Place
Burnaby, BC, Canada
V5A 4V7

-----Original Message-----
From: webtest-admin@lists.canoo.com on behalf of Lisa Crispin
Sent: Tue 4/19/2011 11:22 AM
To: webtest@lists.canoo.com
Subject: [Webtest] examples of how to test emails?
For years I have been curious about the Canoo WebTest steps for testing =
emails, and now I would like to see if that might be a good way for us =
to automate tests for emails. We've been using FitNesse fixtures to test =
them and that seems to have a lot of limitations.

I looked at the manual and Googled for more information on how to test =
emails with WebTest, but what I don't know is how you get ahold of the =
email in order to test it in WebTest?=20

Does anyone have any examples?


Lisa Crispin
Co-author with Janet Gregory, _Agile Testing: A Practical Guide for =
Testers and Agile Teams_ (Addison-Wesley 2009)
Contributor to _Beautiful Testing_ (O'Reilly 2009)
@lisacrispin on Twitter