4 ms·
Nice work. I investigated a few similar services, mailtrap, mailgun, mailosaur. I wanted to try having my end-to-end tests assert that the email which got sent
by umaar 7y ago
Nice work. I investigated a few similar services, mailtrap, mailgun, mailosaur. I wanted to try having my end-to-end tests assert that the email which got sent out actually included the correct info. (As in, you request a password reset to test@emailtesting.tld, and then you make API calls to assert the email exists and includes the correct text)
It works well for peace of mind as it gave me a high degree of confidence that I'm testing almost exactly what the end-user would experience. However, it does add 5-10 seconds of delay to your tests while polling the email inbox, it can be a little expensive depending on your test frequency, I think there are even some cases where you can hurt your email deliverability stats during automated email sending.
In the end, I decided to keep this test manual which I run every now and then only after making big changes. Instead integration tests which mock the email service are probably enough for my use case.
Curious how do others test the end-to-end behaviour of their web application, when it comes to emailing?
- chris_st 7y agoI'm doing an application backed by AWS's Amplify, and so I have to have a service that gets the email with the confirmation code. I'm using Guerrilla Mail[0] for that, and it works, but it's slow to receive the email and make it available. I'm using gauge[1] with taiko[2] to write the tests, and liking it a lot, even though I never liked cucumber. taiko is just very reliable, and the test support code is much nicer to write. [0] https://www.guerrillamail.com https://www.guerrillamail.com [1] https://gauge.org https://gauge.org [2] https://taiko.dev https://taiko.dev
- GordonS 7y agoI'm not huge on mocks, but I usually just mock out an email service (which has been manually tested) - that is, I don't test it end-to-end. Everything apart from the actual sending is tested though, such as testing that the email subject and body that would be sent are as expected. In the past I've also used a local test SMTP server, similar to the service in the article, but much more basic (I forget the name of it now).