环境-黄瓜V.4.2.3 |硒V.3.8.1 | JUnit V.4.12 |黄瓜-jvm-并行插件V.1.2.1 | maven-surefire-plugin V.2.19.1 | maven-compiler-插件v.3.3 在执行cumul-jvm并行和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
我可以理解,黄瓜jvm并行插件中应该有一些错误的配置,可能不是在maven surefire中,因为我在使用命令-e clean install通过eclipse执行POM.XML时遇到编译错误 < / p>
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生成的运行器文件**
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 {
}
答案 0 :(得分:0)
问题是因为将参数指定为格式,而不是使用插件选项。当我使用Cucumber v。4时,它已经贬值了。因此,将格式更改为pom.xml中的插件即可解决此问题。
答案 1 :(得分:0)
删除双引号 “ @guest_plp”