私は別のMavenのプロファイルに統合テストを実行しようとしていますので、私は、次のステップでそれを実行する必要があります。統合テストを実行する前にtomcatを起動するには?
- 実行Tomcatサーバーを。
- Seleniumサーバーを実行します。
- 統合テストを実行します。
次のように私は統合テストを実行します。
mvn install -Pit
をしかし、何が起こるかは、統合テストは、テストが失敗しますサーバーが起動し、前に最初に実行されることを、次のように私の設定です:
<profile>
<id>it</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.4</version>
<configuration>
<wait>false</wait>
<container>
<containerId>tomcat7x</containerId>
<home>${env.CATALINA_HOME}</home>
<timeout>300000</timeout>
</container>
<configuration>
<type>standalone</type>
<home>target/tomcat7x</home>
<properties>
<cargo.jvmargs>-XX:PermSize=256m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
</properties>
</configuration>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-container</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>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
<logOutput>true</logOutput>
</configuration>
</execution>
<execution>
<id>stop</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>
<version>2.8</version>
<configuration>
<junitArtifactName>
org.junit:com.springsource.org.junit
</junitArtifactName>
<excludes>
<exclude>**/unit/*Test.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/integration/*Test.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<activation>
<property>
<name>it</name>
</property>
</activation>
</profile>
私の設定に何が問題なのかアドバイスしてください。
UPDATE:Mavenのログ
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building My APP
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [jaxws:wsimport {execution: default}]
[debug] execute contextualize
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[debug] execute contextualize
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: C:\Workspace\MyAPP\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running integration.MyTest
Update3と:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<configuration>
<skipTests>true</skipTests>
</configuration>
</execution>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/integration/*Test.java</include>
</includes>
<skipTests>false</skipTests>
</configuration>
</execution>
</executions>
<configuration>
<argLine>-Xms256M -Xmx768M -XX:MaxPermSize=256M</argLine>
</configuration>
</plugin>
しかし、問題があります:
それは次のように古い確実なプラグインを置き換える削除した後にうまく働きました貨物プラグインでは、それは戦争ファイルを展開してから積分を実行するということですation testを実行し、テストメソッドを呼び出す前に、warファイルを展開しませんか?
Mavenの実行ログを投稿できますか?もし 'test'ゴールを実行していて、' integration-test'ゴールで失敗するのではなく失敗しているのではないかと思ったら... – Raghuram
maven failsafe plugin(http://maven.apache.org/plugins/)統合テストを実行するには – Raghuram
@Raghuram、ログが追加されました。フェイルセーフを使用してサーフィンを削除する必要がありますか?もしそうなら、フェイルセーフに必要な最低限の設定は何ですか? –