Cucumber-jvm: runtime exception when running a cucumber tests with annotation containing multiple tags

Created on 1 Sep 2012  路  10Comments  路  Source: cucumber/cucumber-jvm

@when Trying to run my cucumber test with multiple tags in @cucumber.options annotation, like..

                   @RunWith(Cucumber.class)
                   @Cucumber.Options(tags = {"@reg","@temp"})

@then I am getting the below exception. But test running fine when run with any single tag like-> tags = {"@reg"}


cucumber.runtime.CucumberException: None of the features at [classpath:] matched the filters: [@reg, @temp]
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:45)
at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:98)
at cucumber.junit.Cucumber.(Cucumber.java:61)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:43)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Thanks,
Phani Kaliginadi

Most helpful comment

Do this:

@Cucumber.Options(tags = {"@reg,@temp"})

See https://github.com/cucumber/cucumber/wiki/Tags

All 10 comments

Do you have scenarios which have both tags reg and temp?

see https://github.com/cucumber/cucumber/wiki/Tags

yes I have scenarios for both the tags and these scenarios running without any problem when running with their single tag name separately in cucumber.options annotation.

But problem occuring when mentioned both the tag names.

[ My project at : https://github.com/kphani/cucumber-selenium-example.git
Testclass: TRun_sandbox]

When you specify tags, only features which have all tags will be executed

given following example:

@temp @reg
Scenario: browser mail example

@reg
Scenario: delete mail

The scenario browser mail example would be executed, but delete mail wouldn't because it does not match all tags

Thanks for clarifying the issue.

Actually I have question and my intention of running above test is---

I have one feature file with @temp tag and another with @reg tag. and many other without any tags.

If just wanted to run feature files with only these two tags. how can I mention the cucumber.options Junit test class.

like: @RunWith(Cucumber.class)
@Cucumber.Options(tags = ??????

Please could you help me.

Do this:

@Cucumber.Options(tags = {"@reg,@temp"})

See https://github.com/cucumber/cucumber/wiki/Tags

Thanks aslakhellesoy

Thank you so much aslakhellesoy,
I had same issue, by this it resolved.

Hi aslakhellesoy,

I am also facing a similar issue as mentioned above. Here are my cucumber profile and my feature file.
When I am running, getting the nullPointerException.

It is passing when running with the single tag.

@CucumberOptions(features = {"src/test/java/features"},
glue = "stepDefs",
tags = {"@web,@android", "~@ignore"},
format = {"pretty", "html:target/cucumber"})

Feature:
@web @android @ios
Scenario: Wordpress Signup scenario
Given User chooses "Signup" option

Could you help me with this.

This ticket was closed 5 years ago. Please open a new ticket. Include as much info as you can, at the very least what version you鈥檙e using.

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.

Was this page helpful?
0 / 5 - 0 ratings