Parameters &引用;“示例表”;在jbehave中显示挂起
故事档案Parameters &引用;“示例表”;在jbehave中显示挂起,parameters,jbehave,Parameters,Jbehave,故事档案 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 | | When the user ent
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 | |
When the user enters the required values as: $dataTable in the text box
步骤类
@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")
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教程,但是没有得到太多关于这个的信息
请注意,我使用Jbehave和小黄瓜
扩展JUnitStores的当前storyrunner文件
** @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));
}**
***覆盖
公共配置(){
类故事文件中的步骤语法:
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(“用户在文本框中输入所需的值:$DataTable”)
public void enterDetails(@Named(“dataTable”)示例稳定的dataTable){
//将步骤实现放在这里
}
更多详情见官方文件:
JBehave的在线文档对ExamplesTable的使用我一点也不清楚。我会将每个条目标记化。我知道这会使行变长,但它会起作用,并且可能会让其他人更清楚地看到发生了什么。我想你理解我的意思,但如果你愿意,我很乐意给出一个示例作为答案你喜欢。谢谢比尔的评论。你是指以下两种方式中的任何一种还是一种新的方式?当用户在文本框中输入时用户在文本框中输入时用户在文本框中输入时用户在文本框中输入时用户在文本框中输入时用户在文本框中输入| sno | name | city | u name | state | name | country | name | 1 | Bank或者当用户在文本框| dataTable | | 1,美国银行,芝加哥,|中输入所需的值时,您可以将其分解为多个步骤,就像这样,但我的意思更像是当用户输入、、
然后在步骤定义中使用Named命名每个参数时的。不过,我有点迂腐,以便使其在报告(JBehave或Extent等)上看起来更美观我真的会使用类似“当用户输入名称”的东西,…这样,报告中的参数,特别是如果缺少参数,就会清晰可见。感谢@BillHileman的评论。我已经找到了24列,所以检查类似的内容。谢谢。这就是我检查的内容。谢谢@VaL。我现在可以从m表格。但对于下面的场景,系统输入并用下一行替换值,而不是遍历每个表格行以查找按钮,因此我只能看到最后一行结果,而不是所有行。当用户输入所需的值时:| sno | name | city | u name | state | name | country | u name | 1 |美洲银行芝加哥2摩根大通伊利诺伊州用户点击查找按钮也更新了问题
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