I've integrated Alluer to my cucumber automation project. After the integration, I can run the tests from feature files, and generate the report successfully as well. However, when I try to run the test from test entry class, there was an Exception came out. Can someone help me with this? Thank you very much.
Error message:
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)
Entry class:
@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>
The problem is that you are using old allure-cucumber-jvm-adaptor
dependency. The correct one is
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber-jvm</artifactId>
<version>2.0-BETA16</version>
</dependency>
Also there is no need to specify additional allure-java-commons
dependency