0

While running my cucumber test using maven ,i am getting build success but none of the tests are running . I have attached :

  • POM dependencies versions
  • Result
  • Structure of the project
  • Runner class

I have followed below work around :

  1. already checked the version compatibility of dependencies guess that is fine
  2. deleted M2 repositories and build the project again
  3. Tried changing the project structure and added naming convention "Test" with java files.

    T E S T S
[INFO] -------------------------------------------------------
[INFO] Running cucumberOptions.TestRunnerTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.026 s - in cucumberOptions.TestRunnerTest
[INFO] Running pages.baseTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in pages.baseTest
[INFO] Running pages.GenericUtilsTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in pages.GenericUtilsTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

POM.xml

<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.7.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>gherkin</artifactId>
    <version>2.12.2</version>

</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.6</version>
</dependency>
</dependencies> 
<build>
    <!-- To define the plugin version in your parent POM -->

      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
        </plugin>
        <plugin> 
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M4</version>
          <configuration>

          </configuration>
        </plugin>
      </plugins>
[updated structure and result][2]

[updated structure][1]
  [1]: https://i.stack.imgur.com/t4Y79.jpg
  [2]: https://i.stack.imgur.com/3fqsL.jpg

P K
  • 1
  • 7
  • Possible duplicate of https://stackoverflow.com/questions/7513319/passing-command-line-arguments-from-maven-as-properties-in-pom-xml – Samuel Liew Mar 23 '20 at 02:06
  • I didn't find my answer in that thread . i guess that talks about some other issue. – P K Mar 23 '20 at 08:59

1 Answers1

0

Your project structure does not follow the maven conventions. All test classes (ending with .java) should go under src/test/java and test resources (ending with .feature) under src/test/resources.

Because your feature files are not the in the right place they're not picked up by Cucumber.

https://maven.apache.org/guides/getting-started/

You may also want to follow the 10-minute Cucumber tutorial so you have a working Cucumber project before adding on Selenium.

https://cucumber.io/docs/guides/10-minute-tutorial/

M.P. Korstanje
  • 10,426
  • 3
  • 36
  • 58
  • Hey, i made the changes to the structure but still the issue exists. Have added the updated result and the structure . – P K Mar 23 '20 at 16:25
  • Doesn't look like it. It should be `src/test/resources` not `src/main/resources`. And you're better of following the tutorials. – M.P. Korstanje Mar 23 '20 at 16:53
  • Thanks made the changes but still the problem persists :( – P K Mar 24 '20 at 09:36