0

I have an issue trying to run my Serenity Runner in IntelliJ IDEA.

I will put the data here:

IntelliJ IDEA 2018.1.5 (Community Edition)
Build #IC-181.5281.24, built on June 12, 2018
JRE: 1.8.0_152-release-1136-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

This is my Runner for Serenity:

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

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
        features =  {"src/test/resource/features"},
        glue=       {"stepdefs"},
        monochrome = true,
        tags =      {"~@Ignore"},
        plugin =    {
                "pretty", "html:target/serenity-reports/serenity-html-report",
                "json:target/serenity-reports/SerenityTestReport.json",
                "rerun:target/serenity-reports/rerun.txt"}
)
public class SerenityRunner {
}

This below is my POM.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>cl.cooper</groupId>
    <artifactId>automation_test_cukes</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <cucumber.version>1.2.5</cucumber.version>
        <java.version>8</java.version>
    </properties>

    <dependencies>
        <!-- CUCUMBER DEPENDENCIES -->
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm</artifactId>
            <version>1.2.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.2.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>1.2.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.mkolisnyk</groupId>
            <artifactId>cucumber-runner</artifactId>
            <version>1.3.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.mkolisnyk</groupId>
            <artifactId>cucumber-report-generator</artifactId>
            <version>1.3.3</version>
            <scope>test</scope>
        </dependency>
        <!-- CUCUMBER DEPENDENCIES -->
        <!-- SELENIUM DEPENDENCIES -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-api</artifactId>
            <version>3.12.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-ie-driver</artifactId>
            <version>3.12.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-support</artifactId>
            <version>3.12.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.12.0</version>
        </dependency>
        <!-- SELENIUM DEPENDENCIES -->
        <dependency>
            <groupId>com.github.stephenc.monte</groupId>
            <artifactId>monte-screen-recorder</artifactId>
            <version>0.7.7.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>22.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.9.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <!--SERENITY DEPENDENCIES-->
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>1.1.36</version>
        </dependency>
        <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>1.1.36</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber</artifactId>
            <version>1.1.36</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.25</version>
        </dependency>
        <!--SERENITY DEPENDENCIES-->
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.21.0</version>
                <configuration>
                       <includes>
                            <include>runners.TestRunner.java</include>
                        </includes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.7.0</version>
                    <configuration>
                        <source>8</source>
                        <target>8</target>
                    </configuration>
                </plugin>

            <!--SERENITY PLUGINS-->
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.21.0</version>
                <configuration>
                    <includes>
                        <include>SerenityRunner.java</include>
                    </includes>
                </configuration>
                <executions>
                     <execution>
                         <goals>
                             <goal>integration-test</goal>
                             <goal>verify</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
             <plugin>
                 <groupId>net.serenity-bdd.maven.plugins</groupId>
                 <artifactId>serenity-maven-plugin</artifactId>
                 <version>1.1.36</version>
                 <executions>
                     <execution>
                         <id>serenity-reports</id>
                         <phase>post-integration-test</phase>
                         <goals>
                             <goal>aggregate</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
             <!--SERENITY PLUGINS-->

            </plugins>
        </build>
        <reporting>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-report-plugin</artifactId>
                    <version>2.21.0</version>
                </plugin>
            </plugins>
        </reporting>
    </project>

My serenity.properties file:

serenity.project.name = automation_test_cukes
serenity.test.root =  src/test/resource/features
serenity.outputDirectory = target/serenity-reports
serenity.take.screenshots= AFTER_EACH_STEP

and this is the issue when I run the Serenity Runner:

    java.lang.NoSuchMethodError: net.thucydides.core.model.DataTable$DataTableBuilder.andScenarioOutline(Ljava/lang/String;)Lnet/thucydides/core/model/DataTable$DataTableBuilder;

    at net.serenitybdd.cucumber.SerenityReporter.thucydidesTableFrom(SerenityReporter.java:364)
    at net.serenitybdd.cucumber.SerenityReporter.examples(SerenityReporter.java:310)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at cucumber.runtime.Utils$1.call(Utils.java:40)
    at cucumber.runtime.Timeout.timeout(Timeout.java:16)
    at cucumber.runtime.Utils.invoke(Utils.java:34)
    at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:294)
    at com.sun.proxy.$Proxy21.examples(Unknown Source)
    at cucumber.runtime.junit.JUnitReporter.examples(JUnitReporter.java:204)
    at cucumber.runtime.junit.ExamplesRunner.run(ExamplesRunner.java:58)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at cucumber.runtime.junit.ScenarioOutlineRunner.run(ScenarioOutlineRunner.java:53)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:95)
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:38)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


Test ignored.

Test ignored.

Test ignored.

I have tried to change the versions in the Serenity dependencies, but I can't find the solution for this. The Serenity folder is generated in target.

If it were useful, this is my pipeline:

|_main
|_test
  |_java
    |_runners
      |_TestRunner
      |_SerenityRunner
    |_stepdefs
      |_ServiceHooks
      |_StepDefinitionsCafest
  |_resource
    |_features
      |_Cafest.feature

Please community: I need your help with this.

nosequeweaponer
  • 511
  • 10
  • 38
  • You should look at upgrading both serenity, serenity-cucumber and cucumber to latest versions. Ones you are using are pretty old... – Grasshopper Jun 20 '18 at 04:28
  • When I update to serenity-core, serenity-junit to 1.9.20, and serenity-cucumber to 1.9.8, I'm facing the next issue: java.lang.NoSuchMethodError: cucumber.runtime.RuntimeOptions.getTagFilters()Ljava/util/List; – nosequeweaponer Jun 20 '18 at 13:16
  • Have u upgraded cucumber too? u r at 1.2.5 where as latest is 3.0.2 – Grasshopper Jun 20 '18 at 13:59
  • My cucumber runs fine with 1.2.5... I will try.... Nooooo!!! When I change the Cucumber versions it displays the next issue: java.lang.VerifyError: Bad type on operand stack Exception Details: Location: cucumber/runtime/ExtendedRuntime.runStep(Ljava/lang/String;Lgherkin/formatter/model/Step;Lgherkin/formatter/Reporter;Lgherkin/I18n;)V @94: invokeinterface Reason:Type 'cucumber/runtime/StepDefinitionMatch' (current frame, stack[1]) – nosequeweaponer Jun 20 '18 at 16:14

1 Answers1

1

Reading other pages, I found the solution:

In my POM, modify the Serenity dependencies below

<!--SERENITY DEPENDENCIES-->
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>1.2.5-rc.6</version>
        </dependency>
        <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>1.2.5-rc.6</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber</artifactId>
            <version>1.1.29</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.25</version>
        </dependency>
        <!--SERENITY DEPENDENCIES-->

Add the next configuration to the POM

<properties>
    <cucumber.version>1.2.5</cucumber.version>
    <serenity.version>1.2.5-rc.6</serenity.version>
    <serenity.cucumber.version>1.1.29</serenity.cucumber.version>
       <java.version>8</java.version>
   </properties>

And use this plugin:

<plugin>
                 <groupId>net.serenity-bdd.maven.plugins</groupId>
                 <artifactId>serenity-maven-plugin</artifactId>
                 <version>1.1.29</version>
                 <executions>
                     <execution>
                         <id>serenity-reports</id>
                         <phase>post-integration-test</phase>
                         <goals>
                             <goal>aggregate</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>

After running my SerenityRunner, the system runs the feature classes without problem. This is the result of that:

[main] INFO net.serenitybdd.core.Serenity - 

        __    _____ _____ ____ _____   ____   _    ____  ____  _____ ____  
  _     \ \  |_   _| ____/ ___|_   _| |  _ \ / \  / ___|/ ___|| ____|  _ \ 
 (_)_____| |   | | |  _| \___ \ | |   | |_) / _ \ \___ \\___ \|  _| | | | |
  _|_____| |   | | | |___ ___) || |   |  __/ ___ \ ___) |___) | |___| |_| |
 (_)     | |   |_| |_____|____/ |_|   |_| /_/   \_\____/|____/|_____|____/ 
        /_/          

Thanks for the help Grasshopper!!!

nosequeweaponer
  • 511
  • 10
  • 38