繁体   English   中英

量角器e2e测试用例失败时如何发送电子邮件?

[英]How to send an email when protractor e2e test case fails?

我正在写量角器e2e测试用例。 在运行测试用例时,如果任何测试用例失败,它应该发送一封电子邮件。 怎么做?

提前致谢。

按照Leo的评论。

这不是您需要在protractor级别上解决的问题。 protractor本身基本上是一个浏览器自动化测试框架,模仿用户操作来测试您的网站。

通过电子邮件报告测试失败的常用方法是在持续集成服务器上执行此操作,如jenkinsbamboo 我们的想法是使用jasmine-reporters JUnitXmlReporter报告生成Junit XML报告, jenkinsbamboo知道如何阅读和分析。 然后,通过电子邮件报告测试结果。

量角器配置中的onprepare()函数中调用JUnitXmlReporter

onPrepare: function() {
    // The require statement must be down here, since jasmine-reporters
    // needs jasmine to be in the global and protractor does not guarantee
    // this until inside the onPrepare function.
    require('jasmine-reporters');
    jasmine.getEnv().addReporter(
      new jasmine.JUnitXmlReporter('xmloutput', true, true));
},

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM