Questions tagged [cucumber-jvm]

Cucumber-JVM is a Cucumber implementation for the most popular JVM languages. Cucumber-JVM currently supports Java. There are also implementations for the following JVM languages, but as of version 2.1.0, they are unsupported: Groovy Scala Clojure Jython JRuby Rhino JavaScript Gosu

Cucumber-jvm is a Java-based tool for behavior-driven development.

Cucumber-JVM is a pure Java implementation of Cucumber, with native support for the most popular JVM languages: Java, Scala, Groovy, Clojure, Rhino, Jython and JRuby.

Cucumber-JVM is the successor of Cuke4Duke, which was the Ruby implementation of Cucumber, running on JRuby. It is faster and also easier to run than its predecessor.

See GitHub project

1356 questions
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
7
votes
2 answers

How to load a value from . properties file in Cucumber-jvm step class

I have written a cucumber integration tests and it is running ok. And then i wanted some class variables from the step.java to get their values from .properties values public class cucumberStepClass { @Value("${value.from.propertiesfile}") …
Manwlis.e
  • 182
  • 1
  • 2
  • 10
7
votes
0 answers

Spring injection in cucumber step definition in case of groovy script

It's quite convenient to implement step definitions using Groovy Script approach, but in this case it's unclear if it's possible to use Spring injection or not. In case of Groovy script there's no class, just set of closures, like…
XZen
  • 225
  • 5
  • 27
  • 49
7
votes
1 answer

Why does Cucumber raise AmbiguousStepDefinitionsException?

cucumber.runtime.AmbiguousStepDefinitionsException: ✽.Given I am an admin user(src/test/resources/features/alerts.feature:9) matches more than one step definition: I am an admin in LoginStepDefinitions.iAmAnAdmin() ^I am an admin user$ in…
Aruna Rao
  • 73
  • 1
  • 1
  • 3
7
votes
4 answers

Is Cucumber-jvm thread safe?

I want to run the same Cucumber tests in multiple threads. More specifically, I have a set of features, and running these features in one thread works fine. I use the JSON formatter to record running time of each step. Now I want to do load test. I…
fhcat
  • 971
  • 2
  • 9
  • 28
7
votes
6 answers

How to organize step definitions when using cucumber-java?

I am new to Cucumber and I am using cucumber-java. The cucumber feature files look great. However, the reuse of step definitions really gets in the way about organizing the step definition code. The most intuitive way for me to organize the step…
JBT
  • 8,498
  • 18
  • 65
  • 104
7
votes
1 answer

How do I specify the step definition prototype name in Intellij Idea?

I write my cucumber scenario to include the following step: And the frabjous bandersnatch whiffled "Callooh" Type alt-enter, choose Create Step Definition, and it produces: @And("^the frabjous bandersnatch whiffled \"([^\"]*)\"$") public void…
Carl Manaster
  • 39,912
  • 17
  • 102
  • 155
7
votes
4 answers

Cucumber JVM: How do I use a double as an input value?

For a Behavior test that I'm trying to write, I require inputs that are floating point. How do I set up my gherkin string to look for these values?
user321605
  • 846
  • 2
  • 7
  • 20
7
votes
2 answers

Is it possible to avoid mutable state using Cucumber-jvm Scala?

With the Cucumber tests, a feature expressed as Given, When and Then is usually implemented as three separate methods. These methods often need to share values, and this it seems that mutable variables are the way to do it. Take the following simple…
Noel M
  • 15,812
  • 8
  • 39
  • 47
7
votes
1 answer

Reusing Cucumber-JVM step definitions in other projects

How can I reuse Cucumber-JVM Step Definitions in other projects to test some typical web actions. The point is that I've created some java project just with Step Definition Implementations of the typical scenario actions like: When I follow the link…
kazakovs
  • 379
  • 1
  • 3
  • 9
6
votes
1 answer

Cucumber Java - JUnit set monochrome over command line

What is the best way to disable color output for my Cucumber JUnit tests when they are run by a build machine? It is possible to set monochrome = true in the @CucumberOptions annotation. The problem with that is, running the Tests locally should…
Marcel
  • 1,606
  • 16
  • 29
6
votes
1 answer

Cucumber launched from Spring Boot app not finding the glue classes in the jar

We have a Spring Boot app and we want to start from within this app the execution of a Cucumber feature. Whenever the user clicks a button in the spring app, then the call comes in a class (CucumberTestService) where we start the execution of our…
Lavinia
  • 141
  • 7
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