3

Is there a reason why maven would not run my AfterClass which is set to alwaysRun=true? BeforeClass is run without issues and test passes according to surefire report. I run command in terminal:

mvn -Dtest=TestSuite2#test_case3 test

and get

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] ------------------------------------------------------------------------

The problem is though that my AfterClass, where I quit driver (driver.quit()) is not run. Everything works as expected, if I run the same test via Eclipse with TestNG (right click on the method, run as TestNG test)

4

1 に答える 1

0

testng.xml を作成し、それに対してテストを実行するため、IDE (Eclipse/IDEA) で動作します。pom.xml を確認し、 Maven Surefire プラグインの構成を修正する必要があります。

于 2016-03-24T08:19:58.243 に答える