2011-02-03 12 views
5

uso maven cargo y selenio para automatización. aquí está el código:maven cargo y selenio

<plugin> 
      <groupId>org.codehaus.cargo</groupId> 
      <artifactId>cargo-maven2-plugin</artifactId> 
      <version>1.0.5</version> 
      <configuration> 
       <wait>false</wait> 
       <container> 
        <containerId>tomcat6x</containerId> 
        <zipUrlInstaller> 
         <url> 
          http://mirrors.enquira.co.uk/apache/tomcat/tomcat-6/v6.0.30/bin/apache-tomcat-6.0.30.zip 
         </url> 
         <installDir>${installDir}</installDir> 
        </zipUrlInstaller> 
        <output> 
         ${project.build.directory}/tomcat6x.log 
        </output> 
        <log>${project.build.directory}/cargo.log</log> 
       </container> 
       <configuration> 
        <home> 
         ${project.build.directory}/tomcat6x/container 
        </home> 
        <properties> 
         <cargo.logging>high</cargo.logging> 
         <cargo.servlet.port>8081</cargo.servlet.port> 
        </properties> 
        <files> 
         <copy> 
          <file>${project.basedir}/src/main/resources/datasource.properties</file> 
          <todir>webapps</todir> 
          <configfile>true</configfile> 
          <overwrite>true</overwrite> 
         </copy> 
        </files> 
        <properties> 
         <customMessage>${catalina.home}</customMessage> 
        </properties> 
       </configuration> 
      </configuration> 
      <executions> 
       <execution> 
        <id>start-container</id> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>configure</goal> 
         <goal>start</goal> 
         <goal>deploy</goal> 
        </goals> 
        <configuration> 
         <deployer> 
          <deployables> 
           <deployable> 
            <groupId>${project.groupId}</groupId> 
            <artifactId>${project.artifactId}</artifactId> 
            <type>war</type> 
            <pingURL>**the url**</pingURL> 
            <pingTimeout>180000</pingTimeout> 
            <properties> 
             <context>**war-name**</context> 
            </properties> 
           </deployable> 
          </deployables> 
         </deployer> 
        </configuration> 
       </execution> 

       <execution> 
        <id>stop-container</id> 
        <phase>post-integration-test</phase> 
        <goals> 
         <goal>stop</goal> 
        </goals> 
       </execution> 
      </executions> 

pero a medida que la guerra comenzó cada vez más grande del PingTimeout comenzó a aumentar, yo no quiero utilizar el tiempo de espera de ping, pero estoy siendo obligado a por el momento, ya que el despliegue se necesita un poco de tiempo y el selenio no espera si el pingtimeout no se menciona.

¿hay alguna solución a este problema?

+0

Podría http://stackoverflow.com/questions/1498967/help-with-selenium-maven-cargo ¿estar relacionado? – Raghuram

Respuesta

1

¿Qué tal el uso de Jetty? El plugin maven-jetty-plugin esperará hasta que su webapp esté cargada. De forma alternativa, puede usar el plugin tomcat-maven-plugin y su objetivo de despliegue para desplegar su aplicación web a una instancia de Tomcat en ejecución a través del Tomcat Manager. Este complemento también esperará con la ejecución (y, por lo tanto, el lanzamiento de sus pruebas de Selenium) hasta que se despliegue la guerra.

Esta es mi configuración. Se pondrá en marcha el embarcadero, implementar la aplicación, lanzar selenio, poner en marcha las pruebas de Selenium y finalmente se cierra todos los servidores:

<plugin> 
     <groupId>org.mortbay.jetty</groupId> 
     <artifactId>maven-jetty-plugin</artifactId> 
     <configuration> 
      <contextPath>/</contextPath> 
      <scanIntervalSeconds>0</scanIntervalSeconds> 
     </configuration> 
     <executions> 
      <execution> 
      <id>start</id> 
      <phase>pre-integration-test</phase> 
      <goals> 
       <goal>run</goal> 
      </goals> 
      <configuration> 
       <daemon>true</daemon> 
      </configuration> 
      </execution> 
      <execution> 
      <id>stop</id> 
      <phase>post-integration-test</phase> 
      <goals> 
       <goal>stop</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 

     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>selenium-maven-plugin</artifactId> 
     <configuration> 
      <background>true</background> 
     </configuration> 
     <executions> 
      <execution> 
      <id>start-selenium</id> 
      <phase>pre-integration-test</phase> 
      <goals> 
       <goal>start-server</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>stop-selenium</id> 
      <phase>post-integration-test</phase> 
      <goals> 
       <goal>stop-server</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 

     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-surefire-plugin</artifactId> 
     <executions> 
      <execution> 
      <id>selenium-tests</id> 
      <phase>integration-test</phase> 
      <goals> 
       <goal>test</goal> 
      </goals> 
      <configuration> 
       <skip>false</skip> 
       <excludes> 
       <exclude>none</exclude> 
       </excludes> 
       <includes> 
       <include>**/*SeleniumTest.java</include> 
       </includes> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 
Cuestiones relacionadas