![](/img/trans.png)
[英]NullPointerException in maven-surefire-plugin when running testng suite xml with maven
[英]Maven, testng, surefire: not running AfterClass
有没有理由为什么maven不会运行设置为alwaysRun = true的AfterClass? 根据surefire报告,BeforeClass运行没有问题和测试通过。 我在终端运行命令:
mvn -Dtest=TestSuite2#test_case3 test
得到
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:10.228s
[INFO] Finished at: Wed Nov 13 18:24:07 EET 2013
[INFO] Final Memory: 14M/114M
[INFO] ------------------------------------------------------------------------
问题是我的AfterClass,我退出驱动程序(driver.quit())没有运行。 如果我通过Eclipse使用TestNG运行相同的测试(右键单击该方法,作为TestNG测试运行),一切都按预期工作
它在IDE(Eclipse / IDEA)中工作,因为它创建了testng.xml并对其运行测试。 您需要检查pom.xml并修改Maven Surefire插件配置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.