我有一个应用程序,用硒和黄瓜进行集成测试 当我执行
时 mvn clean test -Dcucumber.options="--tags @test" -Dbrowser=chrome -P dev
测试运行正常,但最后,在生成surefire报告的同时,我收到了0运行测试的消息“跳过了surefire的执行,因为它已经为此配置运行了”。我没有使用生命周期步骤安装,也不使用TestNG。
这是我的POM文件
<groupId>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</groupId>
<artifactId>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</artifactId>
<version>1.0</version>
<properties>
<junit.version>4.11</junit.version>
<selenium-java.version>3.4.0</selenium-java.version>
<cucumber-junit.version>1.2.4</cucumber-junit.version>
<cucumber-java8.version>1.2.4</cucumber-java8.version>
<cucumber-reports.version>1.0.7</cucumber-reports.version>
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
<jasypt.version>1.8</jasypt.version>
<json-simple.version>1.1.1</json-simple.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium-java.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber-junit.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java8</artifactId>
<version>${cucumber-java8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.mkolisnyk</groupId>
<artifactId>cucumber-reports</artifactId>
<version>${cucumber-reports.version}</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${jasypt.version}</version>
</dependency>
<!--JSON-->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${json-simple.version}</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/test/resources/properties</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>none</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<test-data>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</test-data>
</properties>
</profile>
<profile>
<id>pilot</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<test-data>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</test-data>
</properties>
</profile>
<profile>
<id>prod</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<test-data>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</test-data>
</properties>
</profile>
</profiles>
答案 0 :(得分:1)
我通过改变这样的pom来解决它: 问题大战:有多个配置文件被选为活动默认值,将黄瓜报告从mkolisnyk更改为黄瓜报告,因为mkolisnyk与maven报告冲突。
<modelVersion>4.0.0</modelVersion>
<groupId>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</groupId>
<artifactId>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</artifactId>
<version>1.0</version>
<properties>
<junit.version>4.12</junit.version>
<selenium-java.version>3.4.0</selenium-java.version>
<cucumber-junit.version>1.2.4</cucumber-junit.version>
<cucumber-java8.version>1.2.4</cucumber-java8.version>
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
<maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
<cucumber-reporting.version>1.4.0</cucumber-reporting.version>
<cukedoctor-converter.version>1.0.6</cukedoctor-converter.version>
<jasypt.version>1.8</jasypt.version>
<json-simple.version>1.1.1</json-simple.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium-java.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber-junit.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java8</artifactId>
<version>${cucumber-java8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${jasypt.version}</version>
</dependency>
<!--JSON-->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${json-simple.version}</version>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>${cucumber-reporting.version}</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/test/resources/properties</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>none</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.cukedoctor</groupId>
<artifactId>cukedoctor-maven-plugin</artifactId>
<version>1.0.6</version>
<configuration>
<outputFileName>documentation</outputFileName>
<outputDir>docs</outputDir>
<format>html</format>
<toc>left</toc>
<numbered>true</numbered>
<docVersion>1.0</docVersion>
</configuration>
<executions>
<execution>
<goals>
<goal>execute</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<test-data>testprofiles/XXXXXXXXXXXXXXXXXXXXXXXXXXXX.json</test-data>
</properties>
</profile>
<profile>
<id>pilot</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<test-data>testprofiles/XXXXXXXXXXXXXXXXXXXXXXXXXXXX.json</test-data>
</properties>
</profile>
<profile>
<id>prod</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<test-data>testprofiles/XXXXXXXXXXXXXXXXXXXXXXXXXXXX.json</test-data>
</properties>
</profile>
<profile>
<id>qa</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<test-data>testprofiles/XXXXXXXXXXXXXXXXXXXXXXXXXXXX.json</test-data>
</properties>
</profile>
<profile>
<id>localhost</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<test-data>testprofiles/XXXXXXXXXXXXXXXXXXXXXXXXXXXX.json</test-data>
</properties>
</profile>
</profiles>
</project>