我有一个使用JUnit测试的Maven 3项目,它在Jenkins中运行。
我面临的问题是Jenkins中的执行在selenium错误的情况下没有完成,但有点卡在底部的加载圈。我没有这样的问题通过Eclipse进行相同的测试运行,我得到了相同的错误,但执行完成正确
这是Eclipse和Jenkins中的硒错误:
运行web.backoffice.tests.AccountSuspendedTest 测试运行:1,失败:0,错误:1,跳过:0,已过去时间:10.168 秒&lt;&lt;&lt;失败! testAccountSuspended(web.backoffice.tests.AccountSuspendedTest) 经过的时间:0.001秒<&lt;&lt;错误! org.openqa.selenium.NoSuchElementException:无法找到元素: {“method”:“name”,“selector”:“TopBar”}命令持续时间或超时: 5.07秒有关此错误的文档,请访问:http://seleniumhq.org/exceptions/no_such_element.html构建信息: 版本:'2.31.0',修订版: '1bd294d185a80fa4206dfeab80ba773c04ac33c0',时间:'2013-02-27 13:51:26'系统信息:os.name:'Windows Server 2008 R2',os.arch: 'amd64',os.version:'6.1',java.version:'1.7.0_17'会话ID: 900ce6d7-89e3-4161-97d7-0ed0322cdc8d驱动程序信息: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform = XP, databaseEnabled = true,cssSelectorsEnabled = true, javascriptEnabled = true,acceptSslCerts = true,handlesAlerts = true, browserName = firefox,browserConnectionEnabled = true,nativeEvents = true, webStorageEnabled = true,rotate = false,locationContextEnabled = true, applicationCacheEnabled = true,takesScreenshot = true,version = 17.0.4}] at .FirefoxDriver.findElementInternal_(file:/// C:/Users/ADMINI~1/AppData/Local/Temp/anonymous2457282402693064215webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8281) at .fxdriver.Timer.setTimeout /&lt; .notify(file:/// C:/Users/ADMINI~1/AppData/Local/Temp/anonymous2457282402693064215webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js :382)
POM.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<executable>${env.JAVA_HOME}/bin/javac</executable>
<fork>true</fork>
<verbose>true</verbose>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<jvm>${env.JAVA_HOME}/bin/java</jvm>
<includes>
<include>${runSuite}</include>
</includes>
<forkCount>2</forkCount>
<reuseForks>true</reuseForks>
<parallel>methods</parallel>
<threadCount>2</threadCount>
<systemPropertyVariables>
<appConfig>${app.config}</appConfig>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.14</version>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.31.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-ext</artifactId>
<version>1.7</version>
</dependency>
</dependencies>