serenity-bdd / serenity-cucumber

Cucumber integration for the Serenity BDD Reporting library
Other
78 stars 74 forks source link

Incompatible types- Found: CucumberWithSerenity.class, expected: org.junit.runner.Runner #91

Closed Tech-D closed 7 years ago

Tech-D commented 7 years ago

While defining CucumberWithSerenity test runner I get below error basically saying incompatible type. Has anyone encountered this issue? Incompatible types- Found: CucumberWithSerenity.class, expected: org.junit.runner.Runner

I am creating a simple serenity cucumber BDD automation test using maven on google website just to see how serenity works. Please advise if I am missing anything here.

ATTACHED - pom.xml and error screenshot

wakaleo commented 7 years ago

I can't see any attached files? The simplest way to create a sample project is to use the maven archetypes.

Tech-D commented 7 years ago

There is no issue with dependencies. I can see them downloaded successfully. The issue for me in the statement @RunWith(CucumberWithSerenity.class). import net.serenitybdd.cucumber.CucumberWithSerenity has been included as well.

screenshot

Code:

import cucumber.api.CucumberOptions; import net.serenitybdd.cucumber.CucumberWithSerenity; import org.junit.runner.RunWith;

@RunWith(CucumberWithSerenity.class) @CucumberOptions(features="src/test/resources/features") public class AcceptanceTests { }

POM extract: recent versions are added for below

net.serenity-bdd serenity-core ${serenity.version}
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>${serenity.version}</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber</artifactId>
        <version>${serenity.cucumber.version}</version>
    </dependency>
Tech-D commented 7 years ago

Apparently, there was some issue with cucumber.api.junit and cucumber.api.java jars that were downloaded. I had to delete and freshly download all jars to make it work.

Thanks for the support!

wakaleo commented 7 years ago

Thanks for the update :-)