4

I set Cucumber options into my cucumber project below: enter image description here

And I run test by mvn command line with -Dcucumber.options to override options of my prject:

mvn -f "pom.xml" -Dcucumber.options="--plugin json:report/cucumber.json,junit:target/junitreports.xml --tags @Login" test

But is show error:

Data provider mismatch
Method: runScenario([Parameter{index=0, type=cucumber.api.testng.PickleEventWrapper, declaredAnnotations=[]}, Parameter{index=1, type=cucumber.api.testng.CucumberFeatureWrapper, declaredAnnotations=[]}])
Arguments: [(cucumber.api.testng.CucumberExceptionWrapper)cucumber.api.testng.CucumberExceptionWrapper@a0bf272]
Tam Vo
  • 301
  • 4
  • 13

2 Answers2

7

Need to repeat the plugin option. Try this

--plugin json:report/cucumber.json --plugin junit:target/junitreports.xml
Grasshopper
  • 8,908
  • 2
  • 17
  • 32
  • It work well. Thanks. I have a question: I run cucumber project with java command line: java -classpath "./lib/*";.;"./target/test-classes";"./target/classes" cucumber.api.cli.Main. Can I use @CucumberOptions that set up in my project?. Thanks. – Tam Vo Jul 17 '18 at 09:37
  • No... runners are not used when u use main class to run cucumber. U will need to pass the options in the command itself – Grasshopper Jul 17 '18 at 09:40
  • Thanks, because when I add -p "custom plugin" into terminal, receive of EventHandler always run before beforeScenario of Hook, while expecting the opposite :) – Tam Vo Jul 17 '18 at 09:48
0

Try this ..

@CucumberOptions(features= {"src/test/resources/features"}, glue= {"com"},
    plugin = {"pretty", "junit:target/JUNITReports/report.xml", "html:target/HTMLReports", "json:target/JSONReports/report.json"})
Slava Rozhnev
  • 9,510
  • 6
  • 23
  • 39