Maven test运行testng接收后发送邮件
上一篇 /
下一篇 2014-07-17 15:56:49
/ 个人分类:Selenium
用maven+testng实现运行selenium脚本,然后发送邮件的方法:
maven运行testng.xml,执行testng,这个就用说了,主要是在这之后发送邮件,我写了一个sendEmail的类,然后里面有发送邮件的main方法.pom文件里面添加下面这段
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
version>1.3.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.automation.selenium.apollo.initialization.SendEmail</mainClass>
<arguments>
<argument>arg0</argument>
<argument>arg1</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
maven也可
test阶段,用testng运行selenium,然后发送邮件,但是必须testng执行dr.quite();之后,maven才会运行sendEmail的main方法,这个比较特殊,所以运行testSuite必须在afterSuite之后关闭driver.
收藏
举报
TAG: