Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
3.4k views
by Master (1.2k points)

I am trying to execute tests, but I am getting below exception.


cucumber.runtime.CucumberException: Arity mismatch: Step Definition 'com.genesys.wfm.tests.cucumber.steps.newwfmui.UserSettingsDialogSteps.function(String,String) in file:
Step text: my step texts
 at cucumber.runtime.StepDefinitionMatch.arityMismatch(StepDefinitionMatch.java:111)
 at cucumber.runtime.StepDefinitionMatch.transformedArgs(StepDefinitionMatch.java:66)
 at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:40)
 at cucumber.api.TestStep.executeStep(TestStep.java:102)
 at cucumber.api.TestStep.run(TestStep.java:83)
 at cucumber.api.TestCase.run(TestCase.java:58)
 at cucumber.runner.Runner.runPickle(Runner.java:80)
 at cucumber.runtime.Runtime.runFeature(Runtime.java:119)
 at cucumber.runtime.Runtime.run(Runtime.java:104)
 at cucumber.api.cli.Main.run(Main.java:36)
 at cucumber.api.cli.Main.main(Main.java:18)

1 Answer

0 like 0 dislike
by Master (1.2k points)

When you implemented your feature file, number of Arity with parameters are missing.

Say, your step is as below.

e.g.

in your step defination file, you can write as below

When I am at chennai today at restauran

and your impl looks like this

@When("I am at (.*) (today | tomorrow) at restaurant")

public void at(String cityName){

}

you can either add one more parameter

@When("I am at (.*) (today | tomorrow) at restaurant")

public void at(String cityName, String whenExactly){

}

or you can change your step defination impl like this

@When("I am at (.*) (?:today | tomorrow) at restaurant")

public void at(String cityName){

}

Hope that helps.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...