Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cucumber exception: Arity Mismatch although the parameters matched in gerkins and step definitions #748

Closed
lurong opened this issue Sep 24, 2014 · 3 comments

Comments

@lurong
Copy link

lurong commented Sep 24, 2014

This problem appears in Linux more often than Windows.
cucumber-jvm.version=1.1.8

Feature file clause:

Then the email contents will list the failed and still-processing transaction references with the following trade details
  | Trade Details                                              |
  | 12345 - FAIL - PCHK Failed due to invalid party                    |

Step definition:

Then("""^the email contents will list the failed and still-processing transaction references with the following trade details$""") { (tradeDetails: DataTable) =>
    val expectedResult = tradeDetails.asMaps(classOf[String],classOf[String]).map(_.get("Trade Details")).toList
    //some simple assertion
    }

Error thrown:
cucumber.runtime.CucumberException: Arity mismatch: Step Definition 'ThirdPartyClearingFileDownloadSteps.scala:56' with pattern [^the email contents will list the failed and still-processing transaction references with the following trade details$] is declared with 0 parameters. However, the gherkin step has 1 arguments [Table:[[Trade Details], [12345 - FAIL - PCHK Failed due to invalid party]]].
10:14:00 Step: And the email contents will list the failed and still-processing transaction references with the following trade details
10:14:00 at cucumber.runtime.StepDefinitionMatch.arityMismatch(StepDefinitionMatch.java:100)
10:14:00 at cucumber.runtime.StepDefinitionMatch.transformedArgs(StepDefinitionMatch.java:60)
10:14:00 at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37)
10:14:00 at cucumber.runtime.Runtime.runStep(Runtime.java:298)
10:14:00 at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
10:14:00 at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
10:14:00 at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:48)

Investigation:

private def functionParams(f: Any) =
      f.getClass.getDeclaredMethods.filterNot(_.isBridge).head.getGenericParameterTypes

We think the .head method returns wrong function sometimes and cause the error. Unfortunately we cannot figure out how to fix this. Any help will be appreciated=)

@os97673
Copy link
Member

os97673 commented Sep 24, 2014

This project is for Ruby implementation of cucumber, use cucumber/cucumber-jvm for cucumber-jvm issues

@os97673 os97673 closed this as completed Sep 24, 2014
@brasmusson
Copy link
Contributor

... and in Cucumber-JVM the issue is already fixed by cucumber/cucumber-jvm#768.

@lock
Copy link

lock bot commented Oct 25, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants