首页 > 解决方案 > 执行功能文件时出现异常。我尝试使用插件而不是格式,但问题仍然存在

问题描述

线程“main” cucumber.runtime.CucumberException 中的异常:只有一个格式化程序可以使用 STDOUT,现在 pretty 和 json 都使用它。如果您使用多个格式化程序,则必须在 cucumber.runtime.formatter.PluginFactory.defaultOutOrFailIfAlreadyUsed(PluginFactory.java:185) 在 cucumber.runtime.formatter.PluginFactory.convertOrNull(PluginFactory.java:144) 处使用 PLUGIN:PATH_OR_URL 指定输出路径在 cucumber.runtime.formatter.PluginFactory.instantiate(PluginFactory.java:99) 在 cucumber.runtime.formatter.PluginFactory.create(PluginFactory.java:87) 在 cucumber.runtime.RuntimeOptions.getPlugins(RuntimeOptions.java:241) 在cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:287) at com.sun.proxy.$Proxy0.uri(Unknown Source) at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:

标签: cucumbercucumber-java

解决方案


只需在插件值中提及 json 报告的完整路径即可CucumberOptions。像下面的东西

plugin = {  "pretty","json:target/json/report.json" }

json 报告将在文件中生成,漂亮的插件将使用控制台。


推荐阅读