0

已经使用 QAF-Cucumber 和 Junit 创建了一个项目。如果在我的 POM.xml 中添加了依赖项,则在下面

'''

         <groupId>com.qmetry</groupId> 
         <artifactId>qaf-cucumber</artifactId> 
         <version>2.1.15-beta-3</version> 
         <scope>test</scope> 
     </dependency>
     <dependency>
        <groupId>com.qmetry</groupId>
        <artifactId>qaf</artifactId>
        <version>2.1.15</version>
        <scope>test</scope> 
        <exclusions>
        <exclusion>

           <groupId>com.sun.jersey</groupId>
           <artifactId>jersey-client</artifactId>
       </exclusion>
       <exclusion>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-core</artifactId>
      </exclusion>
      <exclusion>
          <groupId>com.sun.jersey.contribs</groupId>
          <artifactId>jersey-multipart</artifactId>
      </exclusion>      
    </exclusions>
</dependency>

'''

黄瓜跑者代码

'''

   @RunWith(Cucumber.class)
   @CucumberOptions(tags = { "@demo" }, features = "src/test/resources", glue = {
    "com.sample.bdd.stepdef" }, plugin = { "com.qmetry.qaf.automation.cucumber.QAFCucumberPlugin" , 
  "pretty"})
 public class CucumberTest {
}

'''

在 Maven Install 上,没有选择执行任何场景,请在控制台日志下方找到

'''

Running com.sample.bdd.CucumberTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@2437c6dc
log4j:WARN No appenders could be found for logger 
(com.qmetry.qaf.automation.testng.pro.QAFAnnotationTransformer2).
log4j:WARN Please initialize the log4j system properly.
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.073 sec

 Results :

 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

'''

4

2 回答 2

0

确保在 pom.xml 中的任何黄瓜依赖项之前提供了 qaf-cucumber 依赖项。在提供依赖性的同时订购重要。

您还应该使用最新的 qaf-cucumber 版本,就像今天一样,它是 2.1.15。

于 2019-12-13T19:44:49.120 回答
0

这看起来与另一个问题Maven 没有找到要运行的 JUnit 测试重复。解决方案之一是surefire-junit向 plugin添加依赖项maven-surefire-plugin。例如:

<build>
  <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
    <dependencies>
      <dependency>
        <groupId>org.apache.maven.surefire</groupId>
        <artifactId>surefire-junit4</artifactId>
        <version>${maven-surefire-plugin.version}</version>
      </dependency>
    </dependencies>
    </plugin>
  <plugins>
</build>
于 2019-12-19T01:43:56.813 回答