Cucumber-JVM 3 - io.cucumber.datatable.UndefinedDataTableTypeException

后端 未结 4 1972
无人及你
无人及你 2020-12-18 05:03

I updated from Cucumber-JVM 2.4.0 to 3.0.2 in my pom.xml and DataTables started throwing this exception:

io.cucumber.datatable.UndefinedD

4条回答
  •  爱一瞬间的悲伤
    2020-12-18 05:40

    Use DataTableType annotation

    @DataTableType
    public Income incomeEntry(Map entry) {
        return new Income(entry.get("name"), entry.get("amount"), entry.get("frequency"));
    }
    

    Then you can directly use the list of the custom class in step definition

    @When("^I Enter My Regular Income Sources$")
    public void I_Enter_My_Regular_Income_Sources(List incomes) throws Throwable {
        // More code    
    }
    

提交回复
热议问题