This sample demonstrates the usage of mail server activities in Citrus tests. You can also read about this in reference guide.
The todo-list sample application sends out mail reports to users on demand. Citrus is able to trigger the report via Http REST API. In this sample we send out some Http REST calls and wait for the incoming mail in a single test.
First we need the mail server component in Citrus. Lets add this to the configuration:
Now we can receive the mail in the test case.
The mail content is loaded from external file resource. Here is the mail content that we expect to arrive in the test.
Citrus is able to convert mail messages to an internal XML representation. This way the content is more comfortable to compare in validation. The mail response looks like this.
In the sample the success code 250 is returned to the mail client marking that everything is ok. Here we also could place some other code and message in order to simulate mail server problems.
You can run the sample on your localhost in order to see Citrus in action. Read the instructions how to run the sample.