Hi,

this will depend on the API that you're using to talk to your SMTP provider.

For example, with javamail, you could implement a TransportListener

http://docs.oracle.com/javaee/5/api/javax/mail/event/TransportListener.html

I would recommend developing some utility class or component that you can unit test separately to perform the task at hand.

On 10/02/2013 14:07, Julien Martin wrote:

Hello,

I am quite new to BDD, I am trying to use BDD in order to develop a *simple signup module* for a website.

I have the *following scenario*:

|Scenario: An anonymous visitor successfully signs up with the website
Given the following email address:[email protected]  
<mailto:[email protected]>  and a chosen member status of childminder and 
the following password: ------
When the anonymous visitor signs up
Then a confirmation email with activation information is sent to the anonymous 
visitor
|

I am quite at a loss *automating the Then step* ("/Then a confirmation email with activation information is sent to the anonymous visitor/")

Here is what I have undertaken (with JBehave):

|@Given("the following email address: $email and a chosen member status of $status 
and the following password: $password")
public void anonymousVisitorEntersDetails(String email, String status, String 
password) {
     pages.home().open();
     pages.home().enterDetails(email, status, password);
}

@When("the anonymous visitor signs up")
public void anonymousVisitorDoesRegister(String login, String password) {
     pages.home().doRegister();
}

@Then("a confirmation email with activation information is sent to the anonymous 
visitor")
public void activationInformationIsSent() {
     //TODO ??
}
|

I am not sure how to implement the test automation*that will make sure the email was sent out *to the anonymous user.

I would be grateful if some experienced BDD practitionner would help me sort this out...

Thanks in advance,

Julien.


Reply via email to