JUnit测试时发生InitializationError

JUnit测试时发生InitializationError

本文介绍了运行Cucumber JUnit测试时发生InitializationError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 包黄瓜; 
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
format = {pretty},
features =src / features /

public class cucumberRunner {

}

/ p>


  • cucumber-core-1.2.4

  • cucumber-java-1.2.4

  • cucumber-junit-1.2.4

  • junit-4.12

  • Eclipse Mars.1

  • java 8



错误追踪:

What could be the problem?

解决方案

The problem is that your class is located in the package 'cucumber'.Either rename the package or move your step-definitions and other glue-code to a sub-package like 'cucumber.steps' and restrict the lookup of glue-code to this package:

package cucumber;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

 @RunWith(Cucumber.class)
 @CucumberOptions(
    format={"pretty"},
    features= "src/features/",
    glue = "cucumber.steps")
 public class cucumberRunner {}

这篇关于运行Cucumber JUnit测试时发生InitializationError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 19:15