gpt4 book ai didi

java - cucumber .runtime.CucumberException : Couldn't load plugin class: io. qameta.allure.cucumberjvm.AllureCucumberJvm

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:49:43 24 4
gpt4 key购买 nike

我已将 Alluer 集成到我的 cucumber 自动化项目中。集成后,我可以从功能文件运行测试,并成功生成报告。但是,当我尝试从测试入口类运行测试时,出现异常。有人可以帮我弄这个吗?非常感谢。

错误信息:

cucumber.runtime.CucumberException: Couldn't load plugin class: io.qameta.allure.cucumberjvm.AllureCucumberJvm

at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:175)
at cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:165)
at cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:226)
at cucumber.runtime.formatter.PluginFactory.isFormatterName(PluginFactory.java:195)
at cucumber.runtime.RuntimeOptions$ParsedPluginData.addPluginName(RuntimeOptions.java:365)
at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:125)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:89)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:78)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:70)
at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:25)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:56)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.ClassNotFoundException: io.qameta.allure.cucumberjvm.AllureCucumberJvm
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:173)

入门级:

@RunWith(Cucumber.class)
@CucumberOptions(
features = {"src/test/resources/features"},
glue = {"classpath:com.wi***rd.step"},
format = {"pretty", "html:target/cucumber-report", "json:target/cucumber.json"},
tags = {"@Mer***tion, @Add***nal, @MER***CH, @MER***ERR"}
)
public class A***dApplicationTests {
}

POM.xml

        <dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-cucumber-jvm-adaptor</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-java-commons</artifactId>
<version>2.0-BETA15</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumberjvm.AllureCucumberJvm"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.10</version>
</dependency>
</dependencies>
</plugin>
</plugins>

</build>

最佳答案

问题是您使用的是旧的 allure-cucumber-jvm-adaptor 依赖项。正确的是

<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber-jvm</artifactId>
<version>2.0-BETA16</version>
</dependency>

也不需要指定额外的 allure-java-commons 依赖

关于java - cucumber .runtime.CucumberException : Couldn't load plugin class: io. qameta.allure.cucumberjvm.AllureCucumberJvm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45703086/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com