Having difficulty running cucumber test in Maven project

Below are the details of the pom file, runner file, and console output:

Pom.xml file contains information about dependencies and plugins used

<dependencies>
      <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>javax.annotation-api</artifactId>
        <version>1.2</version>
      </dependency>

    // More dependencies listed here

    </dependencies>

  <build>
  <resources>
     <resource>
       <directory>src/test/resources</directory>
       <filtering>true</filtering>
     </resource>
   </resources>
        <plugins>
          // Configuration for maven-compiler-plugin and maven-surefire-plugin
        </plugins>
  </build>

Cucumber Runner file

// Code snippet for CucumberRunnerTest class

Console output

[INFO] -------------------------------------------------------
[INFO]  T E S T S
// Console output summary displayed

The code is not being executed as expected. Maven seems to be ignoring the feature file. I have tried various solutions but the issue persists. Any help in resolving this problem would be greatly appreciated.

Please assist me with this! Thank you!

Answer №1

Your pom file contains several dependencies that are incompatible and not needed. I recommend beginning with the starter project available at: github.com/cucumber/cucumber-java-skeleton/

Answer №2

To implement a separate JUnit runner class, follow these steps:

package utilities;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = "pretty",
        glue = "stepdefinitions",   // the package containing step definitions
        features = "src/test/features")   //the folder where you have your feature file
public class CucumberTestRunner {
}

Next, execute this command:

mvn test

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Selenium struggles with managing an extensive number of rows in a table

I'm currently working on a project that involves counting the number of tr elements in a table. I've stored the tr webElement in a list, but the code crashes when there are too many rows in the table, which can sometimes reach up to 100,000 rows. ...

Maximizing Efficiency: Distributing Tests Equally Across Nodes with Selenium Grid

I need to run a total of 1000 tests, with each node registered to the hub handling 200 tests. I have 5 nodes connected to the hub. What is the best way to achieve this test distribution? ...

What is the best way to continuously run tests in Python with Selenium and unittest?

In this test snippet, you can see my test class. It runs successfully when called once with the command python3 main.py. However, there seems to be an issue when attempting to run this test multiple times, say 100 times. How can I achieve that? When trying ...

Gathering information from various web pages simultaneously without the need to manually navigate through each page using a webdriver

I'm new to the world of web scraping and I've successfully developed a program that allows me to extract specific, dynamic data by utilizing the selenium web driver. My current project involves scraping data from a FAQ page in order to gather in ...

Why does every element appear identical in selenium?

When attempting to convert my Steam game-hours into a pandas dataframe, I am encountering an issue where all the games and hours appear identical. Is there a mistake in my code causing this problem, and if so, how can it be resolved? Output: title ...

The 'webdriver' file must be present in the PATH directory

I've been encountering an issue while trying to utilize selenium in my code, which keeps resulting in the following error: Traceback (most recent call last): File "C:\Users\jensa\AppData\Local\Programs\Python\Pyth ...

Using C# and Selenium to locate and click on an input element based on the text found in

I am attempting to click on an input button with dynamically created main identifiers. To achieve this, I am trying to click it based on the span information that follows. <span id="DYNAMIC" class="a-button a-button-primary pmts-button-input apx-compa ...

Contrasting reactions when running commands in Selenium through scripts versus manually

My goal is to use Selenium to show a table with the maximum number of rows possible. This can be achieved by utilizing a button that adjusts the row count in the table. I've constructed a script for this purpose: url = 'http://www.side.developpe ...

Error: java.lang.IllegalStateException - The path to the driver executable must be specified using the webdriver.chrome.driver system property. The similarity does not address this issue

As I delved into learning Selenium, I encountered an issue while trying to run similar code. Here is what I have: package seleniumPractice; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class seleniumPractic ...

WebDriver and Python: A guide on capturing a dynamically changing URL and storing it in a variable efficiently

Python and Selenium webdriver script: elem = driver.find_element_by_css_selector("#username") elem.send_keys("username") elem = driver.find_element_by_css_selector("#password") elem.send_keys("password") drive ...

VBA automation is unable to retrieve innerText (or innerHTML, value)

I've encountered a problem with getting innertext this time. Despite trying various alternatives, I have not been successful. Firstly, I am using Selenium on VBA with chromedriver. The source website is "[" This website operates within an Iframe. Aft ...

Trouble with clicking in Selenium when using the MicrosoftEdge webdriver

I attempted the usual var elementForMs = driver.findElement(By.xpath(selector)); driver.executeScript("arguments[0].click()", elementForMs); as well as var elementForMs = driver.findElement(By.css(selector)); driver.executeScript("arguments[0].click()" ...

Unable to find the email address box on the AWS login page

Having trouble finding the email input box on the AWS login page? Even after trying css selector and xpath, Selenium is still unable to locate the element. Here is my css selector: #resolver_container > div > input This is the code I am using: We ...

Finding the element and extracting its text value

Below is the HTML code: <span> <b>Order number:</b> </span> <span>A36HASJH</span> The value within the span element, A36HASJH, is dynamic and changes with each order. How can I identify this element and store it as a s ...

dealing with the StaleElementReferenceException while using selenium

Trying to create a web crawler using Selenium, I encountered a StaleElementReferenceException in my program. Initially, I suspected that the exception was caused by crawling pages recursively and navigating to the next page without first returning to the p ...

Difficulty encountered while executing Protractor tests with Selenium Server

Attempting to Execute Protractor/Jasmine/Selenium End-to-End Tests Currently in the process of running end-to-end tests using Protractor with the standalone Selenium server and the chrome driver. Encountering a Selenium server error when attempting to ru ...

Selenium struggles to identify checkbox with intricate attribute definition

I have encountered an issue with locating a checkbox on the web application that I am writing Selenium scripts for. Despite my efforts, the script seems unable to find this particular checkbox. Here is a snippet of my code: WebDriverWait wait = n ...

I'm encountering a webdriver issue in my IntelliJ IDE when trying to run Selenium tests

While working on my Selenium project, I encountered an error in IntelliJ IDE that did not occur when using Eclipse IDE. Attach is a snapshot showcasing the issue. The code runs without any issues in Eclipse, and I have already included the necessary depend ...

Automating tests with d3 technology

Currently, I am facing a challenge with testing d3-based Angular components. My initial plan was to utilize Selenium IDE or Kantu for this purpose, but it appears that these tools are unable to capture interactions with SVG elements. Can anyone suggest a ...

What is the best way to use requests in python to enter text in a textarea, then scrape the html with bs4, all while the input remains hidden?

I'm working on a script that interacts with by sending a string and receiving one or all of the "fancy text" variations provided by the site. I am struggling to identify the input area within the HTML structure, especially since I aim to use requests ...