0

当我尝试将我的黄瓜版本从 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
4

1 回答 1

0

cucumber 1.2.4 具有以下依赖项。检查您安装的版本以确保它们是最新的。

  • info.cukes » 黄瓜核心1.2.4
  • info.cukes » 黄瓜-jvm-deps 1.0.5
  • info.cukes » 小黄瓜2.12.2
  • info.cukes » 黄瓜-junit 1.2.4
  • junit » junit 4.12

可选的

  • net.sourceforge.cobertura » cobertura 2.1.1
  • org.mockito » mockito-all 1.10.19
于 2016-04-19T23:51:15.530 回答