看起来 cucumber-jvm 并行和 surefire 插件配置有问题
Looks like something is wrong in cucumber-jvm parallel and surefire plugin configuration
环境 - Cucumber V.4.2.3 |硒 V.3.8.1 | JUnit V.4.12 | cucumber-jvm- 并行插件 V.1.2.1 | maven-surefire-plugin V.2.19.1 | maven-compiler- 插件 v.3.3
在执行 cucumber-jvm parallel & maven surefire 插件时,我面临以下错误
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel03IT.java:[9,14] cannot find symbol
symbol: method format()
location: @interface cucumber.api.CucumberOptions
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel01IT.java:[9,14] cannot find symbol
symbol: method format()
location: @interface cucumber.api.CucumberOptions
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel02IT.java:[9,14] cannot find symbol
symbol: method format()
location: @interface cucumber.api.CucumberOptions
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------
------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------
------
[INFO] Total time: 6.169 s
[INFO] Finished at: 2019-02-17T13:43:48+05:30
[INFO] ------------------------------------------------------------------
------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-
plugin:3.3:testCompile (default-testCompile) on project
TheDayAfterTomorrow: Compilation failure: Compilation failure:`
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel03IT.java:[9,14] cannot find symbol
[ERROR] symbol: method format()
[ERROR] location: @interface cucumber.api.CucumberOptions
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel01IT.java:[9,14] cannot find symbol
[ERROR] symbol: method format()
[ERROR] location: @interface cucumber.api.CucumberOptions
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel02IT.java:[9,14] cannot find symbol
[ERROR] symbol: method format()
[ERROR] location: @interface cucumber.api.CucumberOptions
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (default-testCompile) on project TheDayAfterTomorrow: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:911)
at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:153)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
我可以理解 cucumber jvm 并行插件中应该有一些错误的配置,可能不是在 maven surefire 中,因为我在使用命令 -e clean 通过 eclipse 执行 POM.XML 时遇到编译错误安装
Cucumber JVM Parallel Plugin Configuration
<plugin>
<groupId>com.github.temyers</groupId>
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>generateRunners</id>
<phase>generate-test-sources</phase>
<goals>
<goal>generateRunners</goal>
</goals>
<configuration>
<glue>com.jacksparrow.automation.steps_definitions.functional</glue>
<outputDirectory>${project.build.directory}/generated-test-sources</outputDirectory>
<featuresDirectory>src/test/resources/features/functional/</featuresDirectory>
<cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
<format>json,html</format>
<tags>"@guest_plp"</tags>
</configuration>
</execution>
</executions>
</plugin>
Maven Surefire Plugin Configuration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<forkCount>2</forkCount>
<reuserForks>true</reuserForks>
<!-- <parallel>all</parallel> -->
<!-- <useUnlimitedThreads>true</useUnlimitedThreads> -->
<!-- <threadCountMethods>2</threadCountMethods> -->
<includes>
<include>**/Parallel*IT.class</include>
</includes>
</configuration>
</plugin>
**Maven Compiler Plugin**
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerVersion>1.8</compilerVersion>
</configuration>
</plugin>
无法理解导致此错误的确切原因。请问是jvm生成的runner文件**
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(strict = true,
features = {"classpath:functional/CheckoutOrderPlacement.feature"},
format = {"json:target/cucumber-parallel/1.json",
"html:target/cucumber-parallel/1.html", "pretty"},
monochrome = false,
tags = {"@guest_plp"},
glue = { "com.jacksparrow.automation.steps_definitions.functional" })
public class Parallel01IT {
}
问题是因为将参数作为格式而不是插件选项。因为我使用的是 Cucumber v. 4,所以它已经贬值了。所以在 pom.xml 中将格式更改为插件解决了问题。
删除双引号
“@guest_plp”
环境 - Cucumber V.4.2.3 |硒 V.3.8.1 | JUnit V.4.12 | cucumber-jvm- 并行插件 V.1.2.1 | maven-surefire-plugin V.2.19.1 | maven-compiler- 插件 v.3.3 在执行 cucumber-jvm parallel & maven surefire 插件时,我面临以下错误
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel03IT.java:[9,14] cannot find symbol
symbol: method format()
location: @interface cucumber.api.CucumberOptions
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel01IT.java:[9,14] cannot find symbol
symbol: method format()
location: @interface cucumber.api.CucumberOptions
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel02IT.java:[9,14] cannot find symbol
symbol: method format()
location: @interface cucumber.api.CucumberOptions
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------
------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------
------
[INFO] Total time: 6.169 s
[INFO] Finished at: 2019-02-17T13:43:48+05:30
[INFO] ------------------------------------------------------------------
------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-
plugin:3.3:testCompile (default-testCompile) on project
TheDayAfterTomorrow: Compilation failure: Compilation failure:`
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel03IT.java:[9,14] cannot find symbol
[ERROR] symbol: method format()
[ERROR] location: @interface cucumber.api.CucumberOptions
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel01IT.java:[9,14] cannot find symbol
[ERROR] symbol: method format()
[ERROR] location: @interface cucumber.api.CucumberOptions
[ERROR] /D:/photon-workspace/TheDayAfterTomorrow/target/generated-test-
sources/Parallel02IT.java:[9,14] cannot find symbol
[ERROR] symbol: method format()
[ERROR] location: @interface cucumber.api.CucumberOptions
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (default-testCompile) on project TheDayAfterTomorrow: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:911)
at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:153)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
我可以理解 cucumber jvm 并行插件中应该有一些错误的配置,可能不是在 maven surefire 中,因为我在使用命令 -e clean 通过 eclipse 执行 POM.XML 时遇到编译错误安装
Cucumber JVM Parallel Plugin Configuration
<plugin>
<groupId>com.github.temyers</groupId>
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>generateRunners</id>
<phase>generate-test-sources</phase>
<goals>
<goal>generateRunners</goal>
</goals>
<configuration>
<glue>com.jacksparrow.automation.steps_definitions.functional</glue>
<outputDirectory>${project.build.directory}/generated-test-sources</outputDirectory>
<featuresDirectory>src/test/resources/features/functional/</featuresDirectory>
<cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
<format>json,html</format>
<tags>"@guest_plp"</tags>
</configuration>
</execution>
</executions>
</plugin>
Maven Surefire Plugin Configuration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<forkCount>2</forkCount>
<reuserForks>true</reuserForks>
<!-- <parallel>all</parallel> -->
<!-- <useUnlimitedThreads>true</useUnlimitedThreads> -->
<!-- <threadCountMethods>2</threadCountMethods> -->
<includes>
<include>**/Parallel*IT.class</include>
</includes>
</configuration>
</plugin>
**Maven Compiler Plugin**
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerVersion>1.8</compilerVersion>
</configuration>
</plugin>
无法理解导致此错误的确切原因。请问是jvm生成的runner文件**
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(strict = true,
features = {"classpath:functional/CheckoutOrderPlacement.feature"},
format = {"json:target/cucumber-parallel/1.json",
"html:target/cucumber-parallel/1.html", "pretty"},
monochrome = false,
tags = {"@guest_plp"},
glue = { "com.jacksparrow.automation.steps_definitions.functional" })
public class Parallel01IT {
}
问题是因为将参数作为格式而不是插件选项。因为我使用的是 Cucumber v. 4,所以它已经贬值了。所以在 pom.xml 中将格式更改为插件解决了问题。
删除双引号 “@guest_plp”