我有一个应用程序正在使用Selenium WebDriver和TestNG进行测试。 我有15个方法用@Test注释标记。 当我开始测试点击鼠标右键测试所有测试15成功完成,但是当我使用命令行用“MVN测试”开始测试Maven的输出是:当在IDEA中运行时测试完成但在Maven中运行时失败
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.company.tests:Selenium:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 43, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Selenium 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Selenium ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\ai\mysel\alexander-aut-webdriver-selenium\fwk\java\trunk\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Selenium ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Selenium ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Selenium ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 5 source files to C:\Users\ai\mysel\alexander-aut-webdriver-selenium\fwk\java\trunk\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.5:test (default-test) @ Selenium ---
[INFO] Surefire report directory: C:\Users\ai\mysel\alexander-aut-webdriver-selenium\fwk\java\trunk\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Starting ChromeDriver (v2.9.248315) on port 21287
Tests run: 22, Failures: 2, Errors: 0, Skipped: 12, Time elapsed: 26.223 sec <<< FAILURE!
Results :
Failed tests:
openLoginPage(com.company.selenium.tests.LoginTest)
openRegistrationPage(com.company.selenium.tests.RegistrationTest)
Tests run: 22, Failures: 2, Errors: 0, Skipped: 12
openLoginPage()并打开注册甚至没有标记为@Test,他们用@BeforeMethod注释标记
为什么有22个测试当我在maven中运行? 如何解决这个所以Maven将运行所有测试15
感谢您的回答,但它没有为我工作 – Alexander 2014-08-28 15:25:23
@亚历山大,我用第三点更新了我的答案。 – 2014-08-28 15:31:31
仍然有比应该更多的测试,但我以某种方式认识到,重新命名我的一个文件与测试减少了错误的数量。用测试重命名其他文件根本没有帮助。所以现在我有19个测试,而不是15个,而@OneMethod中的1个失败不是测试 – Alexander 2014-08-29 09:12:47