question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cucumber.options tags are ignored when running tests from Gradle

See original GitHub issue

Summary

The problem is fully described in this stackoverflow question: https://stackoverflow.com/questions/49919757/cucumber-2-4-0-tags-not-working-with-gradle-4-6

Feature:

Feature: Restaurant

  @dev
  Scenario: Eat cukes

    Given I have 10 cukes in my belly
    Then I eat 1 more cukes

  @pro
  Scenario: Eat mushrooms

    Given I have 10 mushrooms in my belly
    Then I eat 1 more mushrooms

Expected Behavior

./gradlew -Dcucumber.options="--tags @dev" clean test

Should only run tests with @dev tag

Current Behavior

./gradlew -Dcucumber.options="--tags @dev" clean test

Runs all tests, no matter what tag they have.

Steps to Reproduce (for bugs)

Context & Motivation

Our projects use Gradle as build tool, we can’t change to Maven in which the cucumber.options tags do work.

Your Environment

cucumber 2.4.0 Junit jupiter 5.1.1 JUnit Platform 1.1.1 Gradle 4.6/4.7 Java 1.8

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
codependentcommented, Apr 19, 2018

The problem was related to the fact that Gradle forks the test execution into different JVMs, so the initial -D parameters don’t reach the tests.

I would suggest improve the Gradle documentation with the necessary configuration to bridge the JVM parameters:

build.gradle:

test { 
    systemProperty "cucumber.options", System.getProperty("cucumber.options")
}
0reactions
lock[bot]commented, Sep 8, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cucumber Test execution for gradle project via command line ...
I am looking for a solution where we can run specific tags irrespective of what tag is mentioned in Runtest.java. More precisely pass...
Read more >
Using Cucumber with Gradle with tags - Handverdrahtet
I want to run Cucumber from Gradle with the possibility to specify tags. ... 'not @Ignore' : findProperty('tags') + ' and not @Ignore'....
Read more >
Run Gradle Cucumber Tests from Command Line
This will help us to run multiple tags in cucumber. (Cucumber6 and above uses, cucumber.filter.tags , so for the lower version use cucumber....
Read more >
Cucumber Tags - Tools QA
How to run Cucumber Tests in Groups with Cucumber Tags; How to ignore Cucumber Tests; Logically ANDing and ORing Tags. What are Cucumber...
Read more >
Using Cucumber with Gradle - Baeldung
Cucumber is a test automation tool that supports Behavior-Driven ... For example, there are options to filter tests based on names and tags....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found