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

DataTable arguments aren't working with cucumber-scala #443

Closed
prystupa opened this issue Dec 22, 2012 · 1 comment
Closed

DataTable arguments aren't working with cucumber-scala #443

prystupa opened this issue Dec 22, 2012 · 1 comment

Comments

@prystupa
Copy link

It simply throws any time DataTable argument is used:

cucumber.runtime.CucumberException: Not a List type: class java.lang.String
    at cucumber.runtime.table.TableConverter.convert(TableConverter.java:55)
    at cucumber.api.DataTable.convert(DataTable.java:77)
    at cucumber.runtime.StepDefinitionMatch.tableArgument(StepDefinitionMatch.java:101)
    at cucumber.runtime.StepDefinitionMatch.transformedArgs(StepDefinitionMatch.java:81)
    at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:38)
    at cucumber.runtime.Runtime.runStep(Runtime.java:267)
    at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
    at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
    at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:36)

I traced it down to the following comment in the current codebase:

class ScalaStepDefinition(frame:StackTraceElement, name:String, pattern:String, parameterInfos:List[Class[_]], f:List[Any] => Any) extends StepDefinition {

  private val argumentMatcher = new JdkPatternArgumentMatcher(Pattern.compile(pattern))

  def matchedArguments(step: Step) = argumentMatcher.argumentsFrom(step.getName)

  def getLocation(detail: Boolean) = frame.getFileName + ":" + frame.getLineNumber

  def getParameterCount() = parameterInfos.size()

  // TODO: get rid of Transform.scala and leave transformation to be done by core. The correct implementation is commented out
  // below until this is fixed.
  // def getParameterType(index: Int, javaType: Type) = new ParameterInfo(parameterInfos.get(index), null)
  def getParameterType(index: Int, javaType: Type) = new ParameterInfo(classOf[String], null, null, null)

  def execute(i18n: I18n, args: Array[AnyRef]) { f(args.toList) }

  def isDefinedAt(stackTraceElement: StackTraceElement) = stackTraceElement == frame

  def getPattern = pattern
}
@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

2 participants