Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用testng、mavensurefire插件和jvm并行运行测试时出现异常_Maven_Cucumber_Testng_Maven Surefire Plugin_Cucumber Java - Fatal编程技术网

使用testng、mavensurefire插件和jvm并行运行测试时出现异常

使用testng、mavensurefire插件和jvm并行运行测试时出现异常,maven,cucumber,testng,maven-surefire-plugin,cucumber-java,Maven,Cucumber,Testng,Maven Surefire Plugin,Cucumber Java,我正在尝试通过以下方式并行执行cucumber功能文件: 使用cucumber jvm插件和 使用maven surefire插件并行运行它们。在运行 命令“mvn清洁测试”我得到以下错误 下面是我的POM.xml、testng.xml文件和testrunner 下面是我的POM.xml文件 4.0.0 com.parallel com.parallel.testng 1.0-快照 com.github.temyers 黄瓜jvm并行插件 2.1.0 发电商 生成测试源 发电商 步骤定义

我正在尝试通过以下方式并行执行cucumber功能文件: 使用cucumber jvm插件和 使用maven surefire插件并行运行它们。在运行 命令“mvn清洁测试”我得到以下错误

下面是我的POM.xml、testng.xml文件和testrunner


下面是我的POM.xml文件


4.0.0
com.parallel
com.parallel.testng
1.0-快照
com.github.temyers
黄瓜jvm并行插件
2.1.0
发电商
生成测试源
发电商
步骤定义
${project.build.directory}/generated test sources/cumber
C:\Users\mbethu\IdeaProjects\comparalleltestng\src\main\input\features
目标/黄瓜
html
假的
真的
假的
真的
简单的
并行{c}IT
特征
org.apache.maven.plugins
maven编译器插件
3
真的
C:\ProgramFiles\Java\jdk1.8.0\u 201\bin\javac.exe
1.8
1.8
org.apache.maven.plugins
maven surefire插件
2.22.1
src\main\resources\testng.xml
真的
班级
10
src\test\java\testng.xml
org.seleniumhq.selenium
硒爪哇
3.141.59
org.seleniumhq.selenium
硒服务器
3.141.59
黄瓜
小黄瓜
3.2.0
黄瓜
黄瓜
4.3.0
聚甲醛
org.testng
testng
6.14.3
编译
黄瓜
黄瓜爪哇
4.2.3
黄瓜
黄瓜试验
2.0.0
黄瓜
黄瓜皮
4.3.0
黄瓜
黄瓜刺柏
4.2.3
测试
朱尼特
朱尼特
4.12
测试
黄瓜
数据表
1.1.12
黄瓜
黄瓜核
4.3.0
黄瓜
黄瓜皮容器
4.2.3
测试
下面是自动生成的TestRunner
进口cucumber.api.CucumberOptions;
导入cucumber.api.testng.AbstractTestNGCucumberTests;
@CucumberOptions(严格=错误,
features={“C:/Users/mbethu/IdeaProjects/comparalleltestng/src/main/input/features/HomePage.feature”},
plugin={“html:target/cucumber/1.html”},
单色=真,
标记={},
胶水={“步骤定义”})
公共类Parallel01IT扩展AbstractTestNGCucumberTests{
}
[信息]正在扫描项目。。。[资讯][资讯]------------------< com.parallel:com.parallel.testng>--------------[INFO]大楼 com.parallel.testng 1.0-SNAPSHOT[信息] --------------------------------[jar]------------------------------------[INFO][INFO]--- maven clean插件:2.5:clean(默认清洁)@com.parallel.testng--- [INFO][INFO]——maven资源插件:2.6:resources (默认资源)@com.parallel.testng---[警告]正在使用平台 编码(实际上是Cp1252)以复制过滤后的资源,即生成 依赖平台![INFO]正在复制1个资源[INFO][INFO]--- maven编译器插件:3.0:编译(默认编译)@ com.parallel.testng---[INFO]没有要编译的源代码[INFO][INFO]--- 黄瓜jvm并行插件:2.1.0:generateRunners(generateRunners)@ com.parallel.testng---[INFO]添加 C:\Users\mbethu\IdeaProjects\comparalleltestng\target\generated test sources\cumber 测试编译源根目录[INFO][INFO]--- maven资源插件:2.6:testResources(默认testResources)@ com.parallel.testng---[警告]使用平台编码(Cp1252 实际上)复制过滤后的资源,即构建平台 依赖![信息]跳过不存在的资源
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="tests">   <!-- how many scenarios we can execute at a time is mentioned bt data-provider-thread-count-->
    <test name="ChromeTest" thread-count="5">
        <!--  <parameter name="browser" value="chrome"/>-->
        <classes>
        <class name="Parallel02IT"/>
        <class name="Parallel01IT"/>
        </classes>

    </test> <!-- Test -->

  <!--  <test name="new">
        <packages>
            <package name="target.generated-test-sources.cucumber.*"/>
            <package name="target.test-classes.*"/>
        </packages>
    </test>-->

</suite> <!-- Suite -->
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.parallel</groupId>
    <artifactId>com.parallel.testng</artifactId>
    <version>1.0-SNAPSHOT</version>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.temyers</groupId>
                <artifactId>cucumber-jvm-parallel-plugin</artifactId>
                <version>2.1.0</version>
                <executions>
                    <execution>
                        <id>generateRunners</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>generateRunners</goal>
                        </goals>
                        <configuration>
                            <!-- Mandatory -->
                            <!-- comma separated list of package names to scan for glue code -->
                            <glue>stepdefinitions</glue>
                            <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>C:\Users\mbethu\IdeaProjects\comparalleltestng\src\main\input\features</featuresDirectory>
                            <!-- Directory where the cucumber report files shall be written  -->
                            <cucumberOutputDir>target/cucumber</cucumberOutputDir>
                            <!-- comma separated list of output formats json,html,rerun.txt -->
                            <format>html</format>
                            <!-- CucumberOptions.strict property -->
                            <strict>false</strict>
                            <!-- CucumberOptions.monochrome property -->
                            <monochrome>true</monochrome>
                            <!-- The tags to run, maps to CucumberOptions.tags property you can pass ANDed tags like "@tag1","@tag2" and ORed tags like "@tag1,@tag2,@tag3" -->
                            <!-- <tags></tags>-->
                            <!-- If set to true, only feature files containing the required tags shall be generated. -->
                            <filterFeaturesByTags>false</filterFeaturesByTags>
                            <!-- Generate TestNG runners instead of default JUnit ones. -->
                            <useTestNG>true</useTestNG>
                            <!-- The naming scheme to use for the generated test classes.  One of 'simple' or 'feature-title' -->
                            <namingScheme>simple</namingScheme>
                            <!-- 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>
                            <!-- This is optional, required only if you want to specify a custom template for the generated sources (this is a relative path) -->
                            <!--<customVmTemplate>src/test/resources/cucumber-custom-runner.vm</customVmTemplate>-->
                        </configuration>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <fork>true</fork>
                    <executable>C:\Program Files\Java\jdk1.8.0_201\bin\javac.exe</executable>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
                    <!--<forkCount>5</forkCount>
                    <reuseForks>true</reuseForks>-->

                    <suiteXmlFiles>
                        <suiteXmlFile>src\main\resources\testng.xml</suiteXmlFile>
                    </suiteXmlFiles>

                    <testFailureIgnore>true</testFailureIgnore>
                    <parallel>classes</parallel>
                    <threadCount>10</threadCount>
                  <!--  <testErrorIgnore>true</testErrorIgnore>-->
                    <includes>
                        <include>src\test\java\testng.xml</include>
                        <!--<include>**/*IT.class</include>-->
                    </includes>
                </configuration>
            </plugin>
        </plugins>

    </build>


    <dependencies>
        <!-- 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/org.seleniumhq.selenium/selenium-server -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.141.59</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>gherkin</artifactId>
            <version>3.2.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-jvm</artifactId>
            <version>4.3.0</version>
            <type>pom</type>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
            <scope>compile</scope>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.apache.maven.surefire/surefire-testng -->
        <!--    <dependency>
             <groupId>org.apache.maven.surefire</groupId>
             <artifactId>surefire-testng</artifactId>
             <version>2.22.1</version>
         </dependency>-->

        <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-testng -->
        <!-- <dependency>
          <groupId>info.cukes</groupId>
          <artifactId>cucumber-testng</artifactId>
          <version>1.2.5</version>
      </dependency>-->
        <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
        <!-- <dependency>
          <groupId>info.cukes</groupId>
          <artifactId>cucumber-java</artifactId>
          <version>1.2.5</version>
      </dependency>-->

        <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-jvm -->
        <!--      <dependency>
               <groupId>info.cukes</groupId>
               <artifactId>cucumber-jvm</artifactId>
               <version>1.2.5</version>
               <type>pom</type>
           </dependency>-->

        <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-jvm-deps -->
        <!--    <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <version>1.0.5</version>
            <scope>provided</scope>
        </dependency>-->

        <!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
        <!--  <dependency>
              <groupId>info.cukes</groupId>
              <artifactId>gherkin</artifactId>
              <version>2.12.2</version>
              <scope>provided</scope>
          </dependency>
  -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>4.2.3</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>2.0.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-guice -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-guice</artifactId>
            <version>4.3.0</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>4.2.3</version>
            <scope>test</scope>
        </dependency>

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

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

        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>4.3.0</version>
        </dependency>

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

    </dependencies>
</project>


Below are automatically generated testRunners
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;

@CucumberOptions(strict = false,
features = {"C:/Users/mbethu/IdeaProjects/comparalleltestng/src/main/input/features/HomePage.feature"},
plugin = {"html:target/cucumber/1.html"},
monochrome = true,
tags = {},
glue = { "stepdefinitions" })
public class Parallel01IT extends AbstractTestNGCucumberTests {
}
    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>3.141.59</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>4.3.0</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>