当前位置: 首页 > 知识库问答 >
问题:

看起来像是cucumber-jvm并行和肯定火插件配置有问题

湛宝
2023-03-14

环境-cucumber第4.2节。3 |硒V.3。8.1 | JUnit V.4。12 |cucumberjvm-并行插件V.1。2.1 | maven surefire插件V.2。19.1 | maven编译器-插件v.3。3在并行执行时

    [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中,因为我在执行POM时遇到编译错误。使用命令-e clean install通过eclipse访问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生成的运行程序文件**

    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 {
    }

共有2个答案

阎枫涟
2023-03-14

删除双引号“@guest\u plp”

黄弘新
2023-03-14

问题是因为给参数作为格式,而不是给插件选项。因为我使用cucumberv.4,它已经贬值了。因此,将格式更改为插件pom.xml解决了这个问题。

 类似资料:
  • Cucumber测试没有并行运行(Cucumber jvm并行插件)? 如果我使用runner类执行测试,一次将执行一个功能文件,但是当将以下插件添加到POM文件时,似乎没有功能文件执行? 即使我指向了正确的功能文件文件夹? 我的POM文件:

  • 如何为temyers/cucumberJVM并行插件配置扩展报告? 我们使用Teamyers Cumber JVM并行插件,使用Maven surefire插件并行运行Selenium Cumber测试。使用Cucumber JVM并行插件,我们绕过了传统Cucumber runner类的需求 对于每个并行运行,它都会生成单独的报告。 如何为其配置扩展报告。 谢谢

  • 我们正在使用cucumberjvm并行插件自动生成cucumber运行程序。 它会根据跑步者的数量在-1、2、3等文件夹中生成cucumber报告。a) 我想把这些报告合并成一份。b) 正如下面链接中所建议的,我已经配置了一个设置,但它并没有生成数据块报告https://github.com/temyers/cucumber-jvm-parallel-plugin/tree/master/src/

  • 我用maven-surefire-plugin 和cucumber-jvm-并行-插件用forked jvm运行并行测试。我pom.xm碎片https://pastebin.com/98RxWrKX 测试运行正常,所有测试运行正常。但当我运行并行测试时,我的诱惑重用结果是空白的。当我在单一模式下运行测试时,没有问题。 我需要帮助将插件添加到我的项目中。 PS由于项目的外部依赖性,我不能使用jvm4

  • 我试图将我的项目从JDK11升级到JDK14,但是在将java版本设置为14之后,运行测试失败了。当我将jacoco与JMockit结合使用时,我将我的构建配置如下(编辑:jacoco版本为0.8.3/0.8.5,JMockit版本为1.49): 如果我在Java版本设置为11的情况下运行maven,一切都很好,但是当我将Java版本设置为14时,surefire插件抛出了这个错误: 我将问题追踪

  • 我正在使用cucumber-jvm-并行-插件,用于在运行时为我的Java-cucumber测试生成动态运行程序。 对于独立测试,我们有一个叫做重试运行程序的东西,它可以在完成当前cucumber测试后触发。 有什么办法,我可以使用相同的机制为自动生成的运行程序使用上述提到cucumberJVM并行插件?