Questions tagged [cucumber-java]

Cucumber-JVM is a pure Java implementation of Cucumber that supports the most popular programming languages for the JVM. Cucumber-JVM supports the following JVM languages: - Java - Groovy - Scala - Clojure - Jython - JRuby - Rhino JavaScript - Gosu

Cucumber is basically Ruby based. But Java can be used by using Cucumber JVM.

Running You can run it with the tool of your choice. There are several ways to run scenarios with Cucumber-JVM:

  • JUnit Runner
  • CLI Runner
  • Android Runner
  • Third party runners

Cucumber-JVM also integrates with all the popular Dependency Injection containers. For details Dependency Injection

1140 questions
7
votes
6 answers

Conversion of Cucumber DataTable to Map

I am using Cucumber Data Tables. I want to convert this Data Table into a Map rather than a list. So basically what if I use the Header Row as Key and the data rows as value for the key. How should I do that? Let me share 1 example to be more…
Neha
  • 316
  • 1
  • 4
  • 16
7
votes
3 answers

CLI runner cucumber.api.cli.Main cannot find step definitions

Problem Cucumber can't find step definitions when run with a CLI runner, but it can find it when running with the junit runner. That is, when running cucumber-jvm from a linux command line, the feature file is found, but the step definitions file is…
7
votes
8 answers

how to get current Cucumber feature file name at runtime using Java

I want get current feature file name at runtime using Java. I have scenario info in hook but unable to get feature file @Before public void before(final Scenario scenario) { this.scenario = scenario; } Do we have any…
Umesh Kumar
  • 1,387
  • 2
  • 16
  • 34
7
votes
3 answers

Getting error during running Cucumber feature file Unknown option: --plugin

Usage: java cucumber.api.cli.Main [options] [ [FILE|DIR][:LINE[:LINE]*] ]+ Options: -g, --glue PATH Where glue code (step definitions and hooks) is loaded from. -f, --format FORMAT[:PATH_OR_URL] How to format results. Goes to…
Pankaj Kumar
  • 151
  • 1
  • 3
  • 9
6
votes
1 answer

Cucumber kotlin : IllegalStateException when launching test via Intellij

I am trying to launch a cucumber (written in kotlin) via intellij. I have a step definition class described as followed : When I launch the test from Intellij, I have this Exception on the "Given" method: java.lang.IllegalStateException: Could…
6
votes
3 answers

@CucumberOptions in cucumber-junit-platform-engine

I'm trying to migrate my cucumber tests from cucumber-junit to cucumber-junit-platform-engine to be able to use new platform features. How do I redefine my runner to use old @CucumberOptions. I'm investigating the issue but can't seem to find the…
makozaki
  • 3,772
  • 4
  • 23
  • 47
6
votes
1 answer

Java Cucumber does not recognize my string parameter

Cucumber doesn't recognize the String parameter what I would like to use it as currency. It only recognise int value. (It finds the steps because other steps works) @When("I deposit {int} of {string}") public void testDeposit(int value, String…
user2695543
  • 81
  • 4
  • 22
6
votes
3 answers

Cucumber DataTable Error - io.cucumber.datatable.UndefinedDataTableTypeException: Can't convert DataTable to cucumber.api.DataTable

Trying to run a scenario with cucumber/selenium/java/intelliJ, but getting an error regarding the DataTable in one of the steps. The dataTable was working fine and converting the arguments for the step correctly before I started using a test runner…
golf umbrella
  • 233
  • 2
  • 4
  • 16
6
votes
1 answer

List of Java Objects to Cucumber DataTable to perform diff

Let us have the following feature file, Feature: Search Employees Background: Given following employees exists | id | name | department | | 1 | Jack | HR | | 2 | Rachel | Finance | | 3 | Mike |…
Arun Chandrasekaran
  • 2,370
  • 2
  • 23
  • 33
6
votes
3 answers

Cucumber Ordered Tagged Hooks

I am trying to use an ordered, tagged hook using Java cucumber. For example: @Before("@quicklink", order = 20) The compiler doesn't seem to like it. Is it not possible to have an ordered, tagged hook ? Seems like a reasonable combination of…
Walter Kelt
  • 2,199
  • 1
  • 18
  • 22
6
votes
3 answers

Calling one feature file from another feature in cucumber

Consider I have below feature files: Login.feature Feature: Login on website Scenario: Login verification on site Given Navigate to site login page When User enters username 'admin1' And User enters password 'admin1' And User clicks on login…
Megha Dalvi
  • 91
  • 1
  • 1
  • 8
6
votes
6 answers

Java Cucumber: Take @CucumberOptions from external source like a property file

Is it possible to take cucumber option values from a java .properties file? In this SO post, it shows that it is being passed from CLI. Here's my sample class: @RunWith(Cucumber.class) @CucumberOptions( features = {"resources/features/"}, …
iamkenos
  • 1,446
  • 8
  • 24
  • 49
6
votes
5 answers

Cucumber: no backend found when running from Spring Boot jar

I am creating a small testing framework that should utilize both Cucumber and the Spring Boot platform. The idea is to let the whole application be packaged as a single jar and run after the BDD features have been properly parametrized. The…
Marek Puchalski
  • 3,286
  • 2
  • 26
  • 35
6
votes
1 answer

How to have common Cucumber step definitions with their own Spring context configuration despite `Annotations differs on glue classes found`

I have an application that was tested with Cucumber, but since upgrading (Cucumber 1.1.6 to 1.2.5, java 1.6 to 1.8, Spring 3.2.0 to 4.2.6) it no longer works because it complains about Annotations differs on glue classes found The structure is as…
neXus
  • 2,005
  • 3
  • 29
  • 53
6
votes
1 answer

Is it possible to disable Spring's @Async during integration test?

I have a method annotated with @Async say @Async public void createArticles(long Id){} but I'm just trying to a cucumber test of that method. Is it possible to test it synchronously?
user7539762
1
2
3
75 76