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

prystupa opened this Issue Dec 22, 2012 · 0 comments


None yet
2 participants

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(
    at cucumber.api.DataTable.convert(
    at cucumber.runtime.StepDefinitionMatch.tableArgument(
    at cucumber.runtime.StepDefinitionMatch.transformedArgs(
    at cucumber.runtime.StepDefinitionMatch.runStep(
    at cucumber.runtime.Runtime.runStep(
    at cucumber.runtime.model.StepContainer.runStep(
    at cucumber.runtime.model.StepContainer.runSteps(

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment