在Ruby语言中,我可以使用: scenario.file.to_s - (http://rdoc.info/gems/cucumber/Cucumber/Ast/HasLocation#file-instance_method)获取场景文件的名称(例如"login.feature")。
在Cucumber-JVM中有没有办法做到这一点?
发布于 2014-06-30 04:02:30
如果您使用的是junit运行器,请编写自己的格式化程序。
@RunWith(Cucumber.class)
@CucumberOptions(
features = "classpath:features/something.feature",
format = "com.blah.PrintingFormatter",
glue = "com.blah.steps")
public class CucumberTest {
}您的PrintingFormatter应该实现gherkin.formatter.Formatter接口,具体来说就是uri方法。
@Override
public void uri(String uri) {
//do something
}添加println,您将看到您的功能文件的名称。
https://stackoverflow.com/questions/22822782
复制相似问题