使用Maven Postman插件运行测试后无法发送电子邮件

我一直在尝试整个早上,但是在使用Maven从命令行运行我的Selenium测试套件后,没有成功发送电子邮件。 以下是我们如何从命令行运行该套件。

mvn surefire:test 

这是使用Surefire插件运行一套TestNG / Selenium测试。 这很好用,我们想继续使用它。 我需要的是一种在每次运行套件后通过电子邮件发送结果的方法。 我遇到了Postman插件,它看起来很完美。 唯一的问题是我根本无法让它工作。 这是我的maven .pom文件。

  4.0.0 com.mysite.carelogic.selenium automation 0.0.1-SNAPSHOT carelogic-automation automation tests for carelogic webapp   org.seleniumhq.selenium selenium-java 2.37.1   org.testng testng 6.8.7   log4j log4j 1.2.17   commons-lang commons-lang 20030203.000129   org.apache.poi poi-ooxml 3.8-beta4       org.apache.maven.plugins maven-surefire-plugin 2.16   testng.xml     ch.fortysix maven-postman-plugin 0.1.6   send surefire notification deploy  send-mail  false  false conner@mysite.com Automation Test Results relay.mysite.com target/surefire-reports/emailable-report.html  conner@mysite.com conner@gmail.com       org.apache.maven.plugins maven-surefire-report-plugin 2.4.3  true      

我已经与我们的技术人员确认我们的邮件服务器是relay.mysite.com,它可以在端口25上免费使用。不需要用户或密码。 当我运行maven命令时,我的测试运行,我可以看到通过和失败但我没有看到maven尝试发送任何电子邮件的通知。 所以我不知道从哪里开始调试,看看有什么问题。 任何帮助将不胜感激。

* EDIT这是运行上面的mvn命令时得到的命令行输出。 正如您所看到的,一般都没有提到邮递员插件或电子邮件。

 Results : Failed tests: Coleman.shouldBeAbleToVerifyClientCaseLoad:84->BaseSmokeTest.shouldBeAbleToVerifyClientCaseLoad:294 » NoSuchElement Tests run: 2, Failures: 1, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 34.727s [INFO] Finished at: Mon Feb 03 11:44:49 CST 2014 [INFO] Final Memory: 20M/141M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project automation: There are test failures. [ERROR] [ERROR] Please refer to C:\Projects\automation\target\surefire-reports for the individual test results. [ERROR] -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project automation: There are test failures. Please refer to C:\Projects\automation\target\surefire-reports for the individual test results. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures. Please refer to C:\Projects\automation\target\surefire-reports for the individual test results. at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:82) at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:190) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:852) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:720) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 19 more [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

您的Maven执行永远不会到达邮件发送插件,因为存在测试失败。 在maven-surefire-plugin的配置部分添加以下行:

  true true 

那应该可以解决你的问题。