为网站电子邮件功能编写功能测试的好方法是什么?
网站涉及电子邮件功能,例如发送注册信息、密码提醒等。
我尝试从网站外部定期运行完整网站的功能测试,并且需要一种从基于 httplib 的测试脚本接收这些测试电子邮件的方法。
以前,我使用过匿名电子邮件服务,可以在发送后几秒或几分钟内使用 http GET 检索电子邮件内容。
不过,这些系统看起来很脆弱,而且它们涉及屏幕抓取,而屏幕抓取本身就是脆弱的。是否有通过 xml/json GETable 接口提供电子邮件的服务?
有没有一种从根本上更好的方法来解决这个问题?有新的电子邮件网络服务,例如 postmarkapp.com 和 yakmail.com;但前者不会收到邮件,而后者则需要大量的提前准备。
我的测试工具用于实时生产系统的验证测试,因此模拟不是一个好的选择。
Websites involve email functions, such as sending registration information, password reminders, etc.
I try to routinely run functional tests of complete websites from outside the website, and need a way to receive these test emails from an httplib based test script.
Previously, I have used anonymous email services, where the email content can be retrieved seconds or minutes after sending it, with an http GET.
These systems seem fragile, though, and they involve screen scraping, which is itself fragile. Are there services that provide emails via an xml/json GETable interface?
Is there a fundamentally better way to approach this? There are new email web-services like postmarkapp.com and yakmail.com; but the former does not receive mail, and the latter requires significant advance preparation.
My test tools are used for verification testing of live production systems, so mocking is not a good option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想检查代码是否发送电子邮件,以及电子邮件的内容是否正确,则模拟是最好的解决方案。看看更明智。单元测试和模拟测试比集成/功能测试更快、更有帮助(对于调试)。
如果您正在进行用户验收测试,即查看电子邮件在特定电子邮件客户端上的外观,那么您必须手动测试它,并且可能使用脚本来截取电子邮件。
If you're trying to check whether your code sends the emails, and whether the content of the email is correct, mocking is the best solution. Take a look at wiser. Unit tests and mock tests are faster and more helpful (for debugging) than integration/functional tests.
If you're doing a User acceptance test, in terms of looking at what the email looks like on a specific email client, then you have to test it manually and may be use scripts to screenshot your emails.