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="1.0"?>
<!DOCTYPE project SYSTEM "../../dtd/Project.dtd">
<project default="ConfirmActivation">
<target name="ConfirmActivation">
<webtest name="ConfirmActivation on ${mailserver}">
<config
haltonerror="false"
haltonfailure="false"
useInsecureSSL="true">
<option name="ThrowExceptionOnFailingStatusCode" value="false"/>
</config>
<steps>
<echo message="invoke http url before calling emailMessageContentFilter
to work around bug with emailMessageContentFilter"/>
<invoke url="${bastion.prefix}"/>
<verifyTitle text="PMC-Sierra - Broadband Communications and Storage
Chips"/>
<emailSetConfig server="${mailserver}" type="${servertype}"
password="${mpmc.mail.password}" username="${mypmc.mail.username}"
delay="5"/>
<emailStoreMessageId subject="${subject.success}"
property="message_to_save"/>
<emailStoreMessageId subject="${subject.success}"
property="message_to_delete"/>
<echo message="message id is #{message_to_save}" />
<emailMessageContentFilter
messageId="#{message_to_save}"/>
<verifyText text="Thank you for activating your www.pmc-sierra.com
account" />
<retry maxcount="10">
<echo message="find id of first message matching desired subject" />
<emailStoreMessageId subject="${subject.success}"
property="message_to_delete" messageIndex="0"/>
<echo message="delete message" />
<emailDeleteMessage messageId="#{message_to_delete}" />
<echo message="see if any remain" />
<emailStoreMessageCount subject="${subject}"
property="emailcount"/>
<verifyProperty name="emailcount" text="0"/>
</retry>
</steps>
</webtest>
</target>
</project>
Cheers,
Tim Pezarro
Manager, Web Services
Corporate Marketing
[email protected]
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: [email protected] on behalf of Lisa Crispin
Sent: Tue 4/19/2011 11:22 AM
To: [email protected]
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?
Does anyone have any examples?
Thanks,
Lisa
--
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
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest