Couldn’t load plugin class: com.qmetry.qaf.automation.cucumber.QAFCucumberPlugin. It does not implement cucumber.api.Plugin

I planning to use qaf-cucumber library for scenario outlines testdata with external files.

Repo: https://github.com/qmetry/qaf-cucumber Branch: cucumber-4

When I run my runner class I’m getting below error: Couldn’t load plugin class: com.qmetry.qaf.automation.cucumber.QAFCucumberPlugin. It does not implement cucumber.api.Plugin

pom.xml:

 <dependencies>
    <dependency><groupId>com.qmetry</groupId><artifactId>qaf</artifactId><version>2.1.15</version></dependency>
    <dependency><groupId>com.qmetry</groupId><artifactId>qaf-cucumber</artifactId><version>2.1.15-beta-1</version></dependency>
    <dependency><groupId>io.cucumber</groupId><artifactId>cucumber-java</artifactId><version>4.5.1</version></dependency>
    <dependency><groupId>io.cucumber</groupId><artifactId>cucumber-junit</artifactId><version>4.5.1</version><scope>test</scope></dependency>
    <dependency><groupId>io.cucumber</groupId><artifactId>cucumber-plugin</artifactId><version>5.1.3</version></dependency>
    <dependency><groupId>io.cucumber</groupId><artifactId>cucumber-core</artifactId><version>4.5.1</version></dependency>
    <dependency><groupId>com.aventstack</groupId><artifactId>extentreports-cucumber4-adapter</artifactId><version>1.0.8</version><scope>compile</scope></dependency>
    <dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.13.1</version><scope>compile</scope></dependency>
    <dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.13.1</version><scope>compile</scope></dependency>
    <dependency><groupId>io.cucumber</groupId><artifactId>cucumber-junit</artifactId><version>4.5.1</version><scope>compile</scope></dependency>
    <dependency><groupId>net.masterthought</groupId><artifactId>cucumber-reporting</artifactId><version>4.10.0</version></dependency>
</dependencies>

RunnerClass:

import io.cucumber.junit.CucumberOptions;
import io.cucumber.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
    features="src/main/java/Features",
    glue={"StepDefs"},
    monochrome=true,
    plugin = { "pretty", "com.qmetry.qaf.automation.cucumber.QAFCucumberPlugin"}
)

public class JunitRunner {

}

feature file:

  @smoke
  Scenario Outline: Search Keyword using data from file
  Given I am on Google Search Page
  When I search for "<searchKey>"

  Examples:{'datafile':'resources/testdata.json'}

StepDefs:

import com.qmetry.qaf.automation.step.QAFTestStep;
import com.qmetry.qaf.automation.step.QAFTestStepProvider;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.When;

public class GoogleClass {

    @Given("I am on Google Search Page")
    @QAFTestStep(description="I am on Google Search Page")
    public void iAmOnGoogleSearchPage(){
          System.out.println("I am on Google Search Page --- New");
    }

    @When("^I search for "([^"]*)"$")
    @QAFTestStep(description = "I search for {0}")
    public void iSearchFor(String s) {
        System.out.println("I search for " + s);
    }

    @QAFTestStep(description="it should have {0} in search results")
    public void itShouldHave_inSearchResults(String s) {
        System.out.printf("it should have %s in search resultsn", s);
    }

}

Exception:

cucumber.runtime.CucumberException: Couldn't load plugin class: com.qmetry.qaf.automation.cucumber.QAFCucumberPlugin. It does not implement cucumber.api.Plugin

at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:178)
at cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:165)
at cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:222)
at cucumber.runtime.formatter.PluginFactory.isStepDefinitionReporterName(PluginFactory.java:205)
at io.cucumber.core.options.RuntimeOptionsBuilder$ParsedPluginData.addPluginName(RuntimeOptionsBuilder.java:218)
at io.cucumber.core.options.RuntimeOptionsBuilder.addPluginName(RuntimeOptionsBuilder.java:73)
at io.cucumber.core.options.CucumberOptionsAnnotationParser.addPlugins(CucumberOptionsAnnotationParser.java:96)
at io.cucumber.core.options.CucumberOptionsAnnotationParser.parse(CucumberOptionsAnnotationParser.java:51)
at io.cucumber.junit.Cucumber.<init>(Cucumber.java:91)
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:423)
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:70)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:50)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

Leave a Comment