Search code examples
cucumbercucumber-javacucumber-junit

How to concatenate Terminal filter with Junit filter


Hello i have the below CucumberOptions on my Junit Runner:

@CucumberOptions(plugin = {"pretty", "json:target/cucumber_parallel.json", "junit:target/cucumber_parallel-junit-report.xml",
        "rerun:target/failed_scenarios/failed_parallel_once.txt", "timeline:target/timeline"},
        features = {"classpath:features/parallel"},
        tags = "(not @Ignored)",
        glue = {"com.intrasoft.swp.trader.stepdefs"},
        monochrome = true)

and we use maven command to execute the suites

mvn clean test -Dcucumber.filter.tags="@one"

right now the tag passed from the Terminal command overwrites the one set on Junit.

what I would is that when filter.tags are set on the maven command the filter that will be used is

@one and (not @Ignored)

the concatenations of both filters.

i would like this because user execute it manually and forgot to specify the @Ignored


Solution

  • It is not possible. Cucumber runner cannot merge options from different sources. It loads options from 4 sources:

    1. from propfety file
    2. from annotation
    3. from environment variable
    4. from system variable

    Each time on a given step it completely overrides the values configured on previous step.