Search code examples
cucumbertestngbddcucumber-java

Illegal initializer for 'java.lang.String' error while supplying tags as cucumber options in my runner class


I'm getting compilation error- Illegal initializer for 'java.lang.String' while supplying tags as cucumber options in my runner class. This used to work well with info.cukes, but not working after upgrading to io.cucumber.

Here is my runner class-

import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;

@CucumberOptions(
        features = "target/test-classes",
        monochrome = true,
        plugin ={"json:target/cucumber-report.json", "html:target/cucumber-reports.html"},
        tags = {"@Smoke", "@Sanity","@Reg"} )

public abstract class BaseRunner extends AbstractTestNGCucumberTests {
}

attaching same below- enter image description here


Solution

  • Replace with tags="@Smoke or @Sanity or @Reg", or tags="@Smoke and @Sanity and @Reg", whichever you want.