Skip to content

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

Closed
prystupa opened this Issue Dec 22, 2012 · 0 comments

2 participants

@prystupa

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
}
@lucas-matt lucas-matt added a commit to lucas-matt/cucumber-jvm that referenced this issue Jan 31, 2013
@lucas-matt lucas-matt Added cucumber scenario to reproduce issue #443 DataTable arguments a…
…ren't working with cucumber-scala
026ab1b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.