cucumber.runtime.CucumberException:无法加载插件 class:json-与 Cucumber Selenium 和 Java 相得益彰

cucumber.runtime.CucumberException: Couldn't load plugin class: json-pretty with Cucumber Selenium and Java

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

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

原因:java.lang.ClassNotFoundException:json-漂亮

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

public class CucumberTest {
//codes
}

看来你们很接近。

您需要更改 插件 定义如下:

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 }