java - 无法在 Gauge 中解析动态参数

标签 java testing automated-tests bdd getgauge

我尝试在 Gauge 规范中使用 file 特殊参数。

Export a customer
----------------------------------------
* Find customer "Hans"
* Export customer to <file:/customer.xml>

Java 实现如下所示

@Step("Export customer to <file>")
public void test(String file) {
   System.out.println("file " + file);
}

我假设参数 typ 是 String (它也可以是 File 吗?)

但是,尽管如此,运行它,返回

[ParseError] C:\Users\user\IdeaProjects\qmsgauge\specs\tenantManagement.spec:40 
 Dynamic parameter <file:/customer.xml> could not be resolved => 'Export customer to <file:/customers.xml>'
Successfully generated html-report to => C:\Users\user\IdeaProjects\qmsgauge\reports\html-report\index.html

如何在规范中定义文件参数以及如何为此编写 java 实现?

谢谢

最佳答案

以“/”开头的路径假定它是根。如果使用相对路径,不要以“/”开头

所以参数值可以是-file:specs/example.spec

关于java - 无法在 Gauge 中解析动态参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48540846/

相关文章:

c# - Resharper 提示测试项目中的得分方法不足

bash - 如何编写可以通用测试执行命令输出的 Bash 函数?

facebook - 我们是否可以假设测试 Facebook Web InstantGame 也将涵盖测试 Facebook APP InstantGame?

java - 如何使用 selenium 检查链接是否处于 Activity 状态

automated-tests - Azure 数据工厂测试框架

Java - 将 null 作为参数传递给 print()

java - tomcat多线程问题

java - Java 中带有 Throw 的 Try-catch 的优先级

java - 基于regedit生成jpos.xml

ruby-on-rails - rails 2.3.10 open_session - 缺少方法