0

have created a project using QAF-Cucumber and using Junit. below if the dependency which has been added in my 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>

'''

Cucumber runner code

'''

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

'''

on Maven Install, no scenarios are picked up for execution, please find below the console logs

'''

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

'''

user861594
  • 5,733
  • 3
  • 29
  • 45
Sssssss
  • 31
  • 4

2 Answers2

0

Make sure you have qaf-cucumber dependency provided before any cucumber dependency in the pom. Order important while providing dependency.

You also should use latest qaf-cucumber release, which is 2.1.15 as if today.

user11353541
  • 125
  • 10
  • have added the qaf-cucumber dependency before the cucumber dependency. still seeing the same issue. we are using Junit runner but in the console i am seeing Running com.sample.bdd.CucumberTest Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@2437c6dc is there something i am missing that it is trying to configure testNG een when i have my runner with junit – Sssssss Dec 13 '19 at 21:11
  • Problem looks more related to running junit with Maven rather than qaf and/or cucumber. – user11353541 Dec 13 '19 at 21:30
  • if i right click on the cucumber runner and run as Junit, able to execute without any issue. but when i try with Maven getting issue. – Sssssss Dec 13 '19 at 22:55
0

This looks duplicate to another question Maven does not find JUnit tests to run. One of the solution is by adding dependency surefire-junit to plugin maven-surefire-plugin. For example:

<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>
user861594
  • 5,733
  • 3
  • 29
  • 45