Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 2 帮助处理Selenium Maven货物_Maven 2_Selenium_Maven Plugin - Fatal编程技术网

Maven 2 帮助处理Selenium Maven货物

Maven 2 帮助处理Selenium Maven货物,maven-2,selenium,maven-plugin,Maven 2,Selenium,Maven Plugin,我尝试使用cargo部署和启动我的容器(工作正常),然后使用selenium执行一些UI测试 每当我尝试运行(mvn clean integration test)时,我都会达到它所说的程度 Launching Selenium Server Waiting for Selenium Server... [INFO]Redirecting output to [INFO]User extensions 但是我的集成测试从来没有被surefire执行过。非常感谢您的帮助。似乎Selenium服务

我尝试使用cargo部署和启动我的容器(工作正常),然后使用selenium执行一些UI测试

每当我尝试运行(mvn clean integration test)时,我都会达到它所说的程度

Launching Selenium Server
Waiting for Selenium Server...
[INFO]Redirecting output to
[INFO]User extensions
但是我的集成测试从来没有被surefire执行过。非常感谢您的帮助。似乎Selenium服务器从未启动过

请注意,我正在使用JUnit4.4

我尝试使用ANT,通过selenium服务器进行复制,并以此方式启动selenium。当我这样做时,我的集成测试运行,但我得到了以下错误,这就是为什么我试图使用selenium maven插件

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)

我终于成功了。以下是使这项工作成功的两个因素:

  • JBOSS在默认启动时在4444上启动了它的RMI端口(与Selenium相同)。我不知道为什么这不是很明显,可能是maven文件中的运行顺序。我在selenium maven插件配置中添加了一个端口,并在surefire插件PRESTO中添加了一个系统属性selenim.port,它工作了

  • 我的Codehause插件库(发布selenium maven插件)设置为snapshots(DOH)。我把它改为发行回购协议,这似乎让事情进展顺利

  • 我将项目的类型更改为“pom”,因此它没有尝试创建JAR

  • 我不知道这是否重要,但我将surefire插件移到了selenium maven插件之后


  • 在我看来,您的配置还可以,需要检查一些事项:IE是否安装到非标准位置?如果使用命令行选项:-Ddebug=trueSelenium依赖项没有问题,您会看到什么?
    com.adminserver.pas.test.SimpleSmokeTest
    在您的IDE中运行良好吗?谢谢您的反馈。我将检查IE安装和调试。帕斯卡,我不知道硒的依赖性。似乎我从来没有启动过“Selenium服务器”,这正是我所期望的;它只是挂着不回来。当我在预集成测试中使用ant运行selenium服务器时,测试至少运行了,但失败了,我猜是因为我在运行它时进行了分叉和繁殖。它可能已失败,因为服务器尚未启动。IE安装在C:\Program Files\Internet Explorer上。在调试模式下运行此功能没有多大帮助。。。。。。。17:57:13614信息[org.openqa.selenium.server.SeleniumServer]在调试模式下运行的selenium服务器。17:57:13755信息[org.mortbay.http.HttpServer]版本Jetty/5.1.x 17:57:13755信息[org.mortbay.util.Container]启动HttpContext[/,/]17:57:13755信息[org.mortbay.util.Container]启动HttpContext[/selenium server,/selenium server]……感谢您发布解决问题的方法(特别是selenium和JBoss之间的端口冲突,非常有价值)
    <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> 
    
    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