0

黃瓜測試沒有並行運行(cucumber-jvm-parallel-plugin)?黃瓜測試沒有並行運行(cucumber-jvm-parallel-plugin)?

如果我使用runner類執行我的測試,一個功能文件將一次執行,但是當將以下插件添加到我的POM文件時,似乎沒有功能文件執行?

即使我指出正確的功能文件文件夾?

我的POM文件:

<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.pim</groupId> 
    <artifactId>PimCucumberFramework</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>PimCucumberFramework</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <build> 
     <pluginManagement> 
      <plugins> 
      <plugin> 
    <groupId>com.github.temyers</groupId> 
    <artifactId>cucumber-jvm-parallel-plugin</artifactId> 
    <version>4.1.0</version> 
    <executions> 
    <execution> 
     <id>generateRunners</id> 
     <phase>generate-test-sources</phase> 
     <goals> 
     <goal>generateRunners</goal> 
     </goals> 
     <configuration> 
     <!-- Mandatory --> 
     <!-- List of package names to scan for glue code. --> 
     <glue> 
      <package>com.example</package> 
      <package>com.example.other</package> 
     </glue> 
     <!-- These are optional, with the default values --> 
     <!-- Where to output the generated tests --> 
     <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>src/test/java/resources/features</featuresDirectory> 
     <!-- Directory where the cucumber report files shall be written --> 
     <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir> 
     <!-- List of cucumber plugins. When none are provided the json formatter is used. For more 
      advanced usage see section about configuring cucumber plugins --> 
     <plugins> 
      <plugin> 
       <name>json</name> 
      </plugin> 
      <plugin> 
       <name>com.example.CustomHtmlFormatter</name> 
       <extension>html</extension> 
      </plugin> 
     </plugins> 
     <!-- CucumberOptions.strict property --> 
     <strict>true</strict> 
     <!-- CucumberOptions.monochrome property --> 
     <monochrome>true</monochrome> 
     <!-- The tags to run, maps to CucumberOptions.tags property. Default is no tags. --> 
     <tags> 
      <tag>@important</tag> 
     </tags> 
     <!-- Generate TestNG runners instead of JUnit ones. --> 
     <useTestNG>false</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>SCENARIO</parallelScheme> 
     <!-- Specify a custom template for the generated sources (this is a path relative to the project base directory) --> 
     <customVmTemplate>src/test/resources/cucumber-custom-runner.vm</customVmTemplate> 
     <!-- Specify a custom package name for generated sources. Default is no package.--> 
     <packageName>com.example</packageName> 
     </configuration> 
    </execution> 
    </executions> 
</plugin> 
      </plugins> 
     </pluginManagement> 
    </build> 

    <dependencies> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-java</artifactId> 
      <version>3.4.0</version> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.12</version> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-java</artifactId> 
      <version>1.2.5</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-jvm</artifactId> 
      <version>1.2.5</version> 
      <type>pom</type> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-junit</artifactId> 
      <version>1.2.5</version> 
      <scope>test</scope> 
     </dependency> 


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

     <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-html --> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-html</artifactId> 
      <version>0.2.3</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-deps --> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-jvm-deps</artifactId> 
      <version>1.0.5</version> 
     </dependency> 

     <!-- https://mvnrepository.com/artifact/info.cukes/gherkin --> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>gherkin</artifactId> 
      <version>2.12.2</version> 
     </dependency> 

     <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all --> 
     <dependency> 
      <groupId>org.hamcrest</groupId> 
      <artifactId>hamcrest-all</artifactId> 
      <version>1.3</version> 
     </dependency> 

     <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-picocontainer --> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-picocontainer</artifactId> 
      <version>1.2.5</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> 

     <!-- Extent Reports --> 
     <dependency> 
      <groupId>com.aventstack</groupId> 
      <artifactId>extentreports</artifactId> 
      <version>3.0.5</version> 
     </dependency> 

     <!-- https://mvnrepository.com/artifact/org.freemarker/freemarker --> 
     <dependency> 
      <groupId>org.freemarker</groupId> 
      <artifactId>freemarker</artifactId> 
      <version>2.3.26-incubating</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting --> 
     <dependency> 
      <groupId>net.masterthought</groupId> 
      <artifactId>cucumber-reporting</artifactId> 
      <version>3.6.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.vimalselvam</groupId> 
      <artifactId>cucumber-extentsreport</artifactId> 
      <version>2.0.4</version> 
     </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> 
     </dependency> 

     <!--PROBLEM https://mvnrepository.com/artifact/info.cukes/cucumber-spring 
      <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-spring</artifactId> 
      <version>1.2.5</version> </dependency> <dependency> <groupId>info.cukes</groupId> 
      <artifactId>cucumber-guice</artifactId> <version>1.2.5</version> </dependency> --> 
    </dependencies> 
</project> 

項目結構: enter image description here

回答

0
 <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.pim</groupId> 
     <artifactId>PimCucumberFramework</artifactId> 
     <version>0.0.1-SNAPSHOT</version>  
     <packaging>jar</packaging> 
     <name>PimCucumberFramework</name> 
     <url>http://maven.apache.org</url> 
     <properties>  
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> 
     <build> 

    <plugins> 
     <plugin> <groupId>com.github.temyers</groupId> <artifactId>cucumber-jvm-parallel-plugin</artifactId> <version>4.1.0</version> 
     <executions> 
       <execution> 
       <id>generateRunners</id>   
       <phase>generate-test-sources</phase> 
       <goals> 
         <goal>generateRunners</goal> 
       </goals> 
       <configuration> 
       <!-- Mandatory --> 
       <!-- List of package names to scan for glue code. --> 
       <glue> 
         <package>stepDefinitions</package> 
       </glue> 
       <!-- These are optional, with the default values --> 
       <!-- Where to output the generated tests --> 
        <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>src/test/resources/features</featuresDirectory> 
        <!-- Directory where the cucumber report files shall be written -->  
       <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir> 
       <!-- List of cucumber plugins. When none are provided the json formatter is used. For more advanced usage see section about configuring cucumber plugins --> 
       <plugins> 
        <plugin> 
         <name>json</name> 
        </plugin> 
       </plugins> 
       <!-- CucumberOptions.strict property --> <strict>true</strict> 
       <!-- CucumberOptions.monochrome property --> 
       <monochrome>true</monochrome> 
       <!-- The tags to run, maps to CucumberOptions.tags property. Default is no tags. --> 
      <tags> 
        <tag>[email protected]</tag> 
      </tags> 
      <!-- Generate TestNG runners instead of JUnit ones. --> 
      <useTestNG>false</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}Test</namingPattern> 
      <!-- One of [SCENARIO, FEATURE]. SCENARIO generates one runner per scenario. FEATURE generates a runner per feature. -->  
      <parallelScheme>FEATURE</parallelScheme> 
      </configuration> 
     </execution> 
     </executions> 
     </plugin> 
     <plugins> 
</build> <dependencies> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.4.0</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-java</artifactId> <version>1.2.5</version> <scope>test</scope> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-jvm</artifactId> <version>1.2.5</version> <type>pom</type> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-junit</artifactId> <version>1.2.5</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-core --> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-core</artifactId> <version>1.2.5</version> </dependency> <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-html --> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-html</artifactId> <version>0.2.3</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-deps --> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-jvm-deps</artifactId> <version>1.0.5</version> </dependency> <!-- https://mvnrepository.com/artifact/info.cukes/gherkin --> <dependency> <groupId>info.cukes</groupId> <artifactId>gherkin</artifactId> <version>2.12.2</version> </dependency> <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all --> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-all</artifactId> <version>1.3</version> </dependency> <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-picocontainer --> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-picocontainer</artifactId> <version>1.2.5</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> <!-- Extent Reports --> <dependency> <groupId>com.aventstack</groupId> <artifactId>extentreports</artifactId> <version>3.0.5</version> </dependency> <!-- https://mvnrepository.com/artifact/org.freemarker/freemarker --> <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>2.3.26-incubating</version> </dependency> <!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting --> <dependency> <groupId>net.masterthought</groupId> <artifactId>cucumber-reporting</artifactId> <version>3.6.0</version> </dependency> <dependency> <groupId>com.vimalselvam</groupId> <artifactId>cucumber-extentsreport</artifactId> <version>2.0.4</version> </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> </dependency> <!--PROBLEM https://mvnrepository.com/artifact/info.cukes/cucumber-spring <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-spring</artifactId> <version>1.2.5</version> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-guice</artifactId> <version>1.2.5</version> </dependency> --> </dependencies> </project> 
+0

感謝,但dosnt似乎我的目標功能的文件嗎? – xGIx

+0

更新了功能路徑。試着讓我知道。我有同樣的設置,它對我來說工作得很好。 – Murthi

+0

再次感謝您的幫助,我在哪裏添加POM文件中列出的代碼,我是否也需要刪除指向TestNG xml的surefire配置? – xGIx