当我尝试将我的黄瓜版本从 1.1.2 升级到 1.2.4 时出现此错误。我在JDK1.8上运行。
这是代码不起作用
RuntimeOptions runtimeOptions = new RuntimeOptions(System.getProperties(), argv);
Runtime runtime = new Runtime(new MultiLoader(classLoader), classLoader, runtimeOptions);
try {
runtime.writeStepdefsJson();
runtime.run();
} catch (Exception e) {
System.out.println("CucumberMain#run: Exception occured - " + e.toString());
e.printStackTrace();
if (e.toString().contains("None of the features at")) {
System.out.println("This should not be an error if feature file does not contains any scenario for"
+ " execution or marked as ignore through tag " + e.getMessage());
} else {
System.out.println("There is some problem in cucumber execution. Error is: " + e.getMessage());
for (int index = 0; index < argv.length; index++) {
System.out.println("CucumberMain#run: Exception - argument#" + index + ": " + argv[index]);
}
// throw e;
}
}
这是错误输出:
Error:(31, 41) java: no suitable constructor found for RuntimeOptions(java.util.Properties,java.lang.String[])
constructor cucumber.runtime.RuntimeOptions.RuntimeOptions(cucumber.runtime.Env,java.util.List<java.lang.String>) is not applicable
(argument mismatch; java.util.Properties cannot be converted to cucumber.runtime.Env)
constructor cucumber.runtime.RuntimeOptions.RuntimeOptions(cucumber.runtime.formatter.PluginFactory,java.util.List<java.lang.String>) is not applicable
(argument mismatch; java.util.Properties cannot be converted to cucumber.runtime.formatter.PluginFactory)
Error:(33, 27) java: no suitable constructor found for Runtime(cucumber.runtime.io.MultiLoader,java.lang.ClassLoader,cucumber.runtime.RuntimeOptions)
constructor cucumber.runtime.Runtime.Runtime(cucumber.runtime.io.ResourceLoader,cucumber.runtime.ClassFinder,java.lang.ClassLoader,cucumber.runtime.RuntimeOptions) is not applicable
(actual and formal argument lists differ in length)
constructor cucumber.runtime.Runtime.Runtime(cucumber.runtime.io.ResourceLoader,java.lang.ClassLoader,java.util.Collection<? extends cucumber.runtime.Backend>,cucumber.runtime.RuntimeOptions) is not applicable
(actual and formal argument lists differ in length)
constructor cucumber.runtime.Runtime.Runtime(cucumber.runtime.io.ResourceLoader,java.lang.ClassLoader,java.util.Collection<? extends cucumber.runtime.Backend>,cucumber.runtime.RuntimeOptions,cucumber.runtime.RuntimeGlue) is not applicable
(actual and formal argument lists differ in length)
constructor cucumber.runtime.Runtime.Runtime(cucumber.runtime.io.ResourceLoader,java.lang.ClassLoader,java.util.Collection<? extends cucumber.runtime.Backend>,cucumber.runtime.RuntimeOptions,cucumber.runtime.StopWatch,cucumber.runtime.RuntimeGlue) is not applicable
(actual and formal argument lists differ in length)
Error:(35, 20) java: cannot find symbol
symbol: method writeStepdefsJson()
location: variable runtime of type cucumber.runtime.Runtime