如何解决JVM 并行插件问题“无需编译 - 所有类都是最新的”
我附上了我的示例项目结构,你可以检查包名是否正确,我的编译器和jre是同一版本。`
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ CucumberTest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- cucumber-jvm-parallel-plugin:5.0.0:generateRunners (generateRunners) @ CucumberTest ---
[INFO] Adding C:\Users\Bismillah\Documents\workspace-spring-tool-suite-4-4.9.0.RELEASE\CucumberTest\target\generated-test-sources\cucumber to test-compile source root
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ CucumberTest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ CucumberTest ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\Users\Bismillah\Documents\workspace-spring-tool-suite-4-4.9.0.RELEASE\CucumberTest\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ CucumberTest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.204 s
[INFO] Finished at: 2020-12-19T19:13:30+05:30
[INFO] ------------------------------------------------------------------------
我的 POM.XML
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.selenium.try</groupId>
<artifactId>CucumberTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<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>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<compilerVersion>1.8</compilerVersion>
<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>3.0.0-M3</version>
<configuration>
<parallel>methods</parallel>
<threadCount>2</threadCount>
<perCoreThreadCount>false</perCoreThreadCount>
<testFailureIgnore>true</testFailureIgnore>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>com.github.temyers</groupId>
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
<version>5.0.0</version>
<executions>
<execution>
<?m2e ignore?>
<id>generateRunners</id>
<phase>generate-test-sources</phase>
<goals>
<goal>generateRunners</goal>
</goals>
<configuration>
<!-- Mandatory -->
<!-- List of package names to scan for glue code. -->
<glue>com.example</glue>
<!-- These are optional,with the default values -->
<!-- Where to output the generated tests -->
<outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>
<!-- The directory,which must be in the root of the runtime classpath,containing your feature files. -->
<featuresDirectory>src/test/resources/FeatureFiles/</featuresDirectory>
<!-- Directory where the cucumber report files shall be written -->
<cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
<plugins>
<plugin>
<name>json</name>
</plugin>
</plugins>
<tags>
<tag>@tag1</tag>
</tags>
<!-- Generate TestNG runners instead of JUnit ones. -->
<useTestNG>false</useTestNG>
<!-- The class naming pattern to use. Only required/used if naming
scheme is 'pattern'. -->
<namingPattern>Parallel{c}IT</namingPattern>
<!-- One of [SCENARIO,FEATURE]. SCENARIO generates one runner per
scenario. FEATURE generates a runner per feature. -->
<parallelScheme>FEATURE</parallelScheme>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>4.2.3</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>4.2.6</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>4.2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>4.3.0</version>
</dependency>
</dependencies>
</project>
未生成测试资源,也未识别我的脚本,我尝试了多种解决方案。谁能帮我解决这个问题。enter image description here
解决方法
As per the POM structure you have given,include tag is as below-
<includes>
<include>**/*IT.java</include>
</includes>
But as per the project structure your testrunner name is RunnerClass.java,so that
should be`inside include tag. Seems you have copied the settings from the lick below
but forgot to modify it.`
https://maven.apache.org/surefire/maven-failsafe-plugin/examples/inclusion-exclusion.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。