努力实现黄瓜jvm版本4.2.3以实现并行执行

时间:2019-02-18 17:56:50

标签: cucumber

无法连接实现cumber-jvm版本4.2.3并行执行所需遵循的所有条件

我的环境-Cucumber V 4.2.3 |硒V 3.8.1 | Junit-4.2

下面是Eclipse控制台的输出。但是什么也没执行

    [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ TheDayAfterTomorrow ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 14 source files to D:\photon-workspace\TheDayAfterTomorrow\target\test-classes
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.19:test (default-test) @ TheDayAfterTomorrow ---
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 5.986 s
    [INFO] Finished at: 2019-02-18T23:18:26+05:30
    [INFO] ------------------------------------------------------------------------

我也在使用Pico Container来实现DI。

这是我的RunCuke实现

    package com.jacksparrow.automation.suite.runner;

    import org.junit.runner.RunWith;
    import cucumber.api.CucumberOptions;
    import cucumber.api.junit.Cucumber;

    @RunWith(Cucumber.class)
    @CucumberOptions(features = "classpath:features/functional/",
                         glue = {"com.jacksparrow.automation.steps_definitions.functional" },
                       plugin = { "pretty","json:target/cucumber-json/cucumber.json",
                                  "junit:target/Cucumber.xml", "html:target/cucumber-reports"},
                       strict = false,
                       dryRun = false,
                   monochrome = true)

    public class FunctionalRunCuke {
    }

POM.XML

        <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.3</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>datatable</artifactId>
            <version>1.1.12</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>4.2.3</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>4.2.3</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
        </dependency>

        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>3.0.0</version>
        </dependency>

Maven编译器插件

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerVersion>1.8</compilerVersion>
                </configuration>
        </plugin>

Maven-Surefire-Plugin

           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19</version>

                <configuration>
                    <parallel>methods</parallel>
                    <threadCount>4</threadCount>
                </configuration>
            </plugin>

请指导此处缺少的内容,或实现cumber-jvm v4并行执行的步骤。如果有人可以分享详细的步骤,将不胜感激,因为我已经尝试实施了1周,但到目前为止没有成功。

1 个答案:

答案 0 :(得分:0)

问题是由于对testNG的依赖导致Surefire忽略JUnit包装器类。我删除了所有TestNG依赖项,或者可以调用2定义2执行-对于TestNG和JUnit并根据需要禁用一个,我正在使用Maven Surefire版本3.0.0-M3