如何解决错误 java:类型不兼容:cucumber.api.DataTable 无法转换为 java.lang.String
How to resolve Error java: incompatible types: cucumber.api.DataTable cannot be converted to java.lang.String
您好,我目前正在使用 Cucumber 进行测试,我有点难过,错误消息对我没有太大帮助,即使在拖网后我仍然找不到正确的解决方案。
When company send us these XML messages
|fixtures/entitlements/sport_tennis.xml|
|fixtures/entitlements/sport_golf.xml|
@When("^company send us these XML messages$")
public void company_send_us_these_XML_messages(DataTable messages) throws Throwable {
client.publish(messages);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
我目前在主题标题中收到错误消息。
Error java: incompatible types: cucumber.api.DataTable cannot be converted to java.lang.String
我如何处理这些数据table。该消息并没有真正帮助我将其转换为字符串,然后它告诉我需要映射它或将其转换为数据 table。有没有workarounds/solutions。这个让我难住了。
将步骤定义修改成这样
public void company_send_us_these_XML_messages(List<List<String>> messages) {
}
您可以遍历它以将消息作为集合或字符串发送到您的方法。
您好,我目前正在使用 Cucumber 进行测试,我有点难过,错误消息对我没有太大帮助,即使在拖网后我仍然找不到正确的解决方案。
When company send us these XML messages
|fixtures/entitlements/sport_tennis.xml|
|fixtures/entitlements/sport_golf.xml|
@When("^company send us these XML messages$")
public void company_send_us_these_XML_messages(DataTable messages) throws Throwable {
client.publish(messages);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
我目前在主题标题中收到错误消息。
Error java: incompatible types: cucumber.api.DataTable cannot be converted to java.lang.String
我如何处理这些数据table。该消息并没有真正帮助我将其转换为字符串,然后它告诉我需要映射它或将其转换为数据 table。有没有workarounds/solutions。这个让我难住了。
将步骤定义修改成这样
public void company_send_us_these_XML_messages(List<List<String>> messages) {
}
您可以遍历它以将消息作为集合或字符串发送到您的方法。