[Webtest] examples of how to test emails?

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


Lisa,

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}">
      <config
        haltonerror=3D"false"
        haltonfailure=3D"false"
        useInsecureSSL=3D"true">
          <option name=3D"ThrowExceptionOnFailingStatusCode" =
value=3D"false"/>
      </config> =20
      <steps>
        <echo message=3D"invoke http url before calling =
emailMessageContentFilter to work around bug with =
emailMessageContentFilter"/>
        <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}"
          property=3D"message_to_save"/>
        <emailStoreMessageId subject=3D"${subject.success}"
          property=3D"message_to_delete"/>
        <echo message=3D"message id is #{message_to_save}" />
        <emailMessageContentFilter=20
          messageId=3D"#{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}"
            property=3D"emailcount"/>
          <verifyProperty name=3D"emailcount" text=3D"0"/>
        </retry>
      </steps>

    </webtest>
  </target>
</project>

Cheers,

Tim Pezarro
Manager, Web Services
Corporate Marketing
tim_pezarro@pmc-sierra.com
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?
=20
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?

Thanks,
Lisa

--=20
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)
http://lisacrispin.com
@lisacrispin on Twitter