Junit +cucumber 运行报错 initiallizationError

step1: 访问 https://search.maven.org/  搜索下载相关jar包

step2: 访问 http://maven.outofmemory.cn/info.cukes/cucumber-html/0.2.3/  下载  cucumber-html-0.2.3.jar

step3: 导入以上JAR 包 。并配置 Junit环境(Add  library -> Junit4)

 

 

Run as -Junit Test 时,会运行失败,如下报错 :

解决方法1:junit 4.0以上版本需要添加hamcrest.jar 。比如 。。导入hamcrest-core-1.3.jar 

 >>验证无用。另外,发现在导入selenium的jar包的时候,里面其实已经包括了  hamcrest-core-1.3.jar   。不需要重新导入

 

解决方法2:

@Test
public void abc(){}
如果括号内有参数,有一定可能会报这种错误

>>无用 。运行的是简单的测试代码。。都没有参数

 

解决方案3:

升级junit

 

解决方案4:

 junit-dep-4.8.1 换成 4.10版本

 

posted @ 2017-06-09 18:06  风少🌻  阅读(622)  评论(0编辑  收藏  举报