[Webtest] Problems using email steps

Paul King webtest@lists.canoo.com
Sat, 15 Apr 2006 12:50:37 +1000


Due to variations in how email servers work, you sometimes get
problems trying to test them. There are different delays before
they receive messages and many have explicit code to stop multiple
logins - requiring a delay between login attempts. Perhaps the approach
used within the emailManualTests.xml selftest will help:

    <target name="awaitArrival">
        <sleep seconds="15"/><!-- initial delay to wait for messages to arrive -->
        <webtest name="emailManualTests: awaitArrival">
            <steps>
                &sharedConfiguration;
                <emailSetConfig server="${mailserver}" type="${servertype}" password="${password}" username="${username}"/>
                <retry maxcount="15">
                    <sleep seconds="5"/>
                    <emailStoreMessageCount subject="/mailtest - multifiles/" property="emailcount"/>
                    <verifyXPath xpath="#{emailcount}>=3" text="true"/>
                </retry>
            </steps>
        </webtest>
    </target>

Ultimately it would be good to make the steps more robust, e.g. share
a login between steps but at the moment each step does a login, so delays
are often required. Then again, your problem may lie elsewhere.

Regards, Paul.

Michael Knapp wrote:
> Thanks, Siegfried.
> I have latest jars in my canoo/lib;  I don't have  write access to  add
> them to jre/lib/ext (and they are not there), but I did add them to my
> CLASSPATH -- wouldn't that be equivalent?
> 
> I'm not getting the same error.  It seems to go a little bit farther,
> but still behaves oddly.
> 
> I get this output now (edited for shorter lines):
> 
> 
> [emailSetConfig]  INFO (com.canoo.webtest.steps.Step) - \
> 	>>>> Start Step: emailSetConfig "<unknown>" (2/6)
> [emailStoreMessageCount]  INFO (com.canoo.webtest.steps.Step) - \
> 	>>>> Start Step: emailStoreMessageCount "<unknown>" (3/6)
>      [null]  INFO (com.canoo.webtest.steps.Step) - \
> 		>>>> Start Step: null "<unknown>" (4/6)
>      [echo] #{count}
> 
> [emailMessageContentFilter]  INFO (com.canoo.webtest.steps.Step) - \
> 	>>>> Start Step: emailMessageContentFilter "<unknown>" (5/6)
> [emailMessageContentFilter]  INFO (com.canoo.webtest.steps.Step) - \
> 	Running with: Canoo Webtest: R_1196.
> [emailMessageContentFilter]  INFO (com.canoo.webtest.steps.Step) - \
> 	Exception thrown from this class:
> com.canoo.webtest.engine.StepFailedException
> [emailMessageContentFilter]  INFO (com.canoo.webtest.steps.Step) - \
> 	Message was: Could not retrieve message.
> 
> 
> Running this code:
> 
> <emailSetConfig 
> 	server="${mailserver}" 
> 	type="${servertype}"
> 	password="${password}" 
> 	username="${username}" 
> 	delay="5"/>
> 
> <emailStoreMessageCount 
> 	property="count"/>
> 		
> <echo 
> 	message="#{count}"/>
> 
> It also gives a "could not retrieve message" error if I add any content
> filters, however the fact that it can't even get a messge count, but
> doesn't throw a login error, seems troubling.
> 
> I have verified with a separate pop3 client that my settings are ok.
> 
> Again, any more help from anyone is appreciated.
> 
> Thanks
> mike
> 
> 
>> -----Original Message-----
>> From: webtest-admin@lists.canoo.com 
>> [mailto:webtest-admin@lists.canoo.com] On Behalf Of Siegfried Goeschl
>> Sent: Thursday, April 13, 2006 12:53 AM
>> To: webtest@lists.canoo.com
>> Subject: Re: [Webtest] Problems using email steps
>>
>> Hi Michael,
>>
>> you might check which version of javamail your are using - 
>> the latest is
>> javamail-1.3.3 - also check if you have an outdated in in jre/lib/ext
>>
>> Cheers,
>>
>> Siegfried Goeschl
>>
>> Michael Knapp wrote:
>>> Hi,
>>>
>>> Do I need a certain  jar to use the email steps?
>>> Or is this a config error?
>>>
>>> I'm getting:
>>>
>>> java.lang.NoSuchMethodError:
>>> javax.mail.Session.getDebugOut()Ljava/io/PrintStream;
>>>
>>> Executing the following:
>>>
>>>
>>>
>>> 	<emailSetConfig server="${mailserver}" type="${servertype}"
>>>     		password="${password}" username="${username}"
>>> delay="5"/>
>>> 	
>>> 	<emailStoreMessageId subject="XXXXXXXXXXXXXXXXX"
>>>             from="XXXXXXXXX" 
>>>             property="mid1"/>
>>> 			
>>> 	<emailMessageContentFilter save="plain" messageId="#{mid1}" />
>>>
>>> 	<verifyText text="Your order number is:"/>
>>>
>>>
>>> Thanks
>>> mike
>>> _______________________________________________
>>> WebTest mailing list
>>> WebTest@lists.canoo.com
>>> http://lists.canoo.com/mailman/listinfo/webtest
>>>
>> _______________________________________________
>> WebTest mailing list
>> WebTest@lists.canoo.com
>> http://lists.canoo.com/mailman/listinfo/webtest
>>
>>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
> 
>