我正在努力进行集成测试,但是由于某些原因 maven-failsafe-plugin 未运行。 以下是用于集成测试的配置文件。 测试类的名称是AppSmokeTestIT.java。 @Test用于测试。
<a href="/test" download="test">Download</a>
我查看了有关此问题的多篇文章,并已完成以下操作
我尝试只在 build 标签中运行插件。
我尝试添加
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.version}</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<packagingExcludes>${package.excludes}</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>smoke-test</id>
<build>
<finalName>APP</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build.helper.maven.version}</version>
<executions>
<execution>
<id>reserve-network-port</id>
<goals>
<goal>reserve-network-port</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<portNames>
<portName>tomcat.http.port</portName>
</portNames>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat.maven.version}</version>
<configuration>
<port>${tomcat.http.port}</port>
<path>/${project.build.finalName}</path>
<additionalConfigFilesDir>${basedir}/src/test/resources/tomcatconf</additionalConfigFilesDir>
</configuration>
<executions>
<execution>
<id>start-server</id>
<configuration>
<fork>true</fork>
</configuration>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>h
</goals>
</execution>
<execution>
<id>stop-server</id>
<configuration>
</configuration>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.failsafe.version}</version>
<configuration>
<systemPropertyVariables>
<integration-test.url>${tomcat.local.host}${tomcat.http.port}/${project.build.finalName}/</integration-test.url>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${maven.failsafe.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.version}</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<packagingExcludes>${package.excludes}</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
我还尝试运行 maven-failsafe-plugin 版本2.18.1,因为我看到有人遇到此问题,表明它适用于他们。
答案 0 :(得分:0)
很抱歉浪费您的时间。 昨天有个屁,今天早上意识到我在执行全新安装时没有选择所需的配置文件。