cuming.runtime.CucumberException:无法使用Cucumber Selenium和Java加载插件类:json-pretty

时间:2018-12-09 21:49:38

标签: java selenium selenium-webdriver cucumber bdd

我是java黄瓜的新手。遇到此错误:

cucumber.runtime.CucumberException: Couldn't load plugin class: json-pretty

原因:java.lang.ClassNotFoundException:json-pretty

Here is my pom.xml

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin={"pretty", "html:target/cucumber-htmlreport", "json-pretty:target/cucmber-report.json"})

public class CucumberTest {
//codes
}

1 个答案:

答案 0 :(得分:1)

好像你很近。

您需要按以下方式更改插件的定义:

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

@RunWith(Cucumber.class) 
@CucumberOptions( plugin={"pretty:target/cucumber-htmlreport.text", "json:target/cucmber-report.json"})

public class CucumberTest { //codes }