故事档案
When the user enters the required values as: <dataTable> in the text box
|sno|name|city_name|state_name|country_name|
|1|Bank of America|Chicago| | |
|2|JP Morgan | |Illinois | |
Steps.class
@When("the user enters the required values as: <dataTable> in the text box")
public void enterDetails(@Named("dataTable") ExamplesTable dataTable){
在输出中我看到了
When the user enters the required values as: <dataTable> in the text box (PENDING)
测试通过,但步骤显示为待定。
我也尝试使用低于$参数。
故事档案
When the user enters the required values as: $dataTable in the text box
Steps.class
@When("the user enters the required values as: $dataTable in the text box")
public void enterDetails(ExamplesTable dataTable){
这一次,测试在下面的步骤中失败了。
When the user enters the required values as: $dataTable in the text box (FAILED)
(org.jbehave.core.io.StoryResourceNotFound: Story path '$dataTable' not found by class loader sun.misc.Launcher$AppClassLoader@18b4aac2)
任何人都可以在这里指导我。我是否需要更新Storyrunner文件中的任何配置?如果是这样,请在这里说清楚。我已经检查了JBehave教程,但是没有得到很多关于此的信息 http://jbehave.org/reference/stable/tabular-parameters.html
请注意我使用Jbehave和Gherkin
当前的storyrunner文件扩展了JunitStories
** @Override
public Configuration configuration() {
Class<? extends Embeddable> embeddableClass = this.getClass();
return new SeleniumConfiguration()
.useSeleniumContext(context)
.useWebDriverProvider(driverProvider)
.useStepMonitor(new SeleniumStepMonitor(contextView, context, new SilentStepMonitor()))
.useStoryLoader(new LoadFromClasspath(embeddableClass))
.useParameterConverters(new ParameterConverters().addConverters(new ParameterConverters.DateConverter(new SimpleDateFormat("yyyy-MM-dd"))))
.useStoryReporterBuilder(new StoryReporterBuilder()
.withCodeLocation(codeLocationFromClass(embeddableClass))
.withFormats(Format.STATS,
Format.CONSOLE,
Format.HTML
)
.withDefaultFormats()
.withFailureTrace(true));
}**
答案 0 :(得分:1)
故事文件中的步骤语法:
When the user enters the required values as:
|sno|name |city_name|state_name|country_name|
|1 |Bank of America|Chicago | | |
in the text box
步骤实施:
@When("the user enters the required values as:$dataTablein the text box")
public void enterDetails(@Named("dataTable") ExamplesTable dataTable) {
// Put step implementation here
}
更多详细信息,请参阅官方文档: http://jbehave.org/reference/stable/tabular-parameters.html