首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Selenium Maven Cargo的帮助

Selenium Maven Cargo的帮助
EN

Stack Overflow用户
提问于 2009-09-30 15:44:06
回答 1查看 1.7K关注 0票数 1

我正在尝试使用cargo来部署和启动我的容器(它工作得很好),然后使用selenium执行一些UI测试。

每当我尝试运行(mvn clean integration-test)时,我都会看到下面的内容

代码语言:javascript
复制
Launching Selenium Server
Waiting for Selenium Server...
[INFO]Redirecting output to
[INFO]User extensions

但是我的集成测试永远不会被surefire执行。任何帮助都是非常感谢的。Selenium Server似乎从未启动过。

请注意,我使用的是JUnit 4.4

我尝试使用ANT来复制selenium服务器,并以这种方式启动selenium。当我这样做的时候,我的集成测试运行了,但我得到了以下错误,这就是为什么我尝试使用selenium-maven-plugin。

代码语言:javascript
复制
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.3 sec <<< FAILURE!
testAllCriticalPagesLoadWithoutError(com.adminserver.pas.test.SimpleSmokeTest)  Time elapsed: 0.29 sec  <<< ERROR!
java.lang.RuntimeException: Could not start Selenium session: NUL
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)
 at com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:123)
 at com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:104)
 at com.thoughtworks.selenium.SeleneseTestCase.setUp(SeleneseTestCase.java:78)
 at com.adminserver.pas.test.BaseSeleniumTest.setUp(BaseSeleniumTest.java:69)
 at com.adminserver.pas.test.SimpleSmokeTest.setUp(SimpleSmokeTest.java:22)
 at junit.framework.TestCase.runBare(TestCase.java:132)
 at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
 at junit.framework.TestResult$1.protect(TestResult.java:110)
 at junit.framework.TestResult.runProtected(TestResult.java:128)
 at junit.framework.TestResult.run(TestResult.java:113)
 at junit.framework.TestCase.run(TestCase.java:124)
 at junit.framework.TestSuite.runTest(TestSuite.java:232)
 at junit.framework.TestSuite.run(TestSuite.java:227)
 at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
 at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
 at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
 at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
 at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
 at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)

下面是我的pom.xml中的相关代码片段

代码语言:javascript
复制
<plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>selenium-maven-plugin</artifactId>
 <version>1.0</version>

 <executions>
  <execution>
  <id>start-selenium</id>
  <phase>pre-integration-test</phase>
  <goals>
   <goal>start-server</goal>
  </goals>
 </execution>
 </executions>
 <configuration>
  <timeout>30</timeout>
  <background>true</background>
  <port>4444</port>
  <logOutput>true</logOutput>
  <verifyBrowser>*iexplore</verifyBrowser>
 </configuration>
 </plugin>
 <plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.4.2</version>
  <configuration>
  <skip>true</skip>
  <testFailureIgnore>true</testFailureIgnore>     
  </configuration>
  <executions>
   <execution>
    <phase>integration-test</phase>
    <goals>
     <goal>test</goal>
    </goals>
    <configuration>
     <skip>false</skip>
    </configuration>
   </execution>
  </executions>
  </plugin> 

以下是selenium server.log文件的输出:

代码语言:javascript
复制
11:35:51,542 INFO  [org.openqa.selenium.server.SeleniumServer] Java: Sun Microsystems Inc. 1.5.0_19-b02
11:35:51,542 INFO  [org.openqa.selenium.server.SeleniumServer] OS: Windows 2003 5.2 x86
11:35:51,592 INFO  [org.openqa.selenium.server.SeleniumServer] v1.0.1 [2697], with Core v@VERSION@ [@REVISION@]
11:35:51,712 INFO  [org.mortbay.http.HttpServer] Version Jetty/5.1.x
11:35:51,712 INFO  [org.mortbay.util.Container] Started HttpContext[/,/]
11:35:51,722 INFO  [org.mortbay.util.Container] Started HttpContext[/selenium-server,/selenium-server]
11:35:51,722 INFO  [org.mortbay.util.Container] Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:35:51,732 INFO  [org.mortbay.http.SocketListener] Started SocketListener on 0.0.0.0:4444
11:35:51,732 INFO  [org.mortbay.util.Container] Started org.mortbay.jetty.Server@bf32c
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-10-01 20:03:19

我终于让它起作用了。这里有几个让它工作的东西:

默认启动时,

  1. JBOSS在4444上启动了它的RMI (与Selenium相同)。不确定为什么这不是更明显的,也许是maven文件中的运行顺序。我在selenium-maven-plugin配置中添加了一个端口,并在surefire-plugin中添加了selenim.port的系统属性PRESTO,它起作用了。
  2. 我的Codehause插件存储库(发布selenium-maven- plugin )被设置为快照(DOH)。我把这个项目的类型改成了“selenium-maven-plugin

”,这样它就不会尝试创建JAR

  • 了,我不知道这有没有关系,但是我还是把surefire插件移到了pom之后
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1498967

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档