Cannot execute serenity project | Rest Assured Forum
N
Ninad Shivaji Kambli Posted on 17/08/2019

Getting an error

 

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

-------------------------------------------------------------------------------------
_______. _______ .______ _______ .__ __. __ .___________.____ ____
/ || ____|| _ \ | ____|| \ | | | | | |\ \ / /
| (----`| |__ | |_) | | |__ | \| | | | `---| |----` \ \/ /
\ \ | __| | / | __| | . ` | | | | | \_ _/
.----) | | |____ | |\ \----.| |____ | |\ | | | | | | |
|_______/ |_______|| _| `._____||_______||__| \__| |__| |__| |__|
-------------------------------------------------------------------------------------

255 [main] INFO net.serenitybdd.core.Serenity - Test Suite Started: First serenity test
java.lang.NoClassDefFoundError: Could not initialize class net.thucydides.core.model.FeatureTagAsDefined
at net.thucydides.core.model.TestOutcome.setUserStory(TestOutcome.java:1322)
at net.thucydides.core.model.TestOutcome.<init>(TestOutcome.java:408)
at net.thucydides.core.model.TestOutcome.<init>(TestOutcome.java:388)
at net.thucydides.core.model.TestOutcome.forTestInStory(TestOutcome.java:650)
at net.thucydides.core.steps.BaseStepListener.testStarted(BaseStepListener.java:378)
at net.thucydides.core.steps.StepEventBus.testStarted(StepEventBus.java:115)
at net.thucydides.core.steps.StepEventBus.testStarted(StepEventBus.java:142)
at net.thucydides.junit.listeners.JUnitStepListener.testStarted(JUnitStepListener.java:80)
at net.thucydides.junit.listeners.JUnitStepListener.startTestIfNotYetStarted(JUnitStepListener.java:136)
at net.thucydides.junit.listeners.JUnitStepListener.testFailure(JUnitStepListener.java:117)
at org.junit.runner.notification.SynchronizedRunListener.testFailure(SynchronizedRunListener.java:63)
at org.junit.runner.notification.RunNotifier$4.notifyListener(RunNotifier.java:142)
at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
at org.junit.runner.notification.RunNotifier.fireTestFailures(RunNotifier.java:138)
at org.junit.runner.notification.RunNotifier.fireTestFailure(RunNotifier.java:132)
at org.junit.internal.runners.model.EachTestNotifier.addFailure(EachTestNotifier.java:23)
at org.junit.runners.ParentRunner.run(ParentRunner.java:369)
at net.serenitybdd.junit.runners.SerenityRunner.run(SerenityRunner.java:252)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
java.lang.NoClassDefFoundError: Could not initialize class net.thucydides.core.model.FeatureTagAsDefined
at net.thucydides.core.model.TestOutcome.setUserStory(TestOutcome.java:1322)
at net.thucydides.core.model.TestOutcome.<init>(TestOutcome.java:408)
at net.thucydides.core.model.TestOutcome.<init>(TestOutcome.java:388)
at net.thucydides.core.model.TestOutcome.forTestInStory(TestOutcome.java:650)
at net.thucydides.core.steps.BaseStepListener.testStarted(BaseStepListener.java:378)
at net.thucydides.core.steps.StepEventBus.testStarted(StepEventBus.java:115)
at net.thucydides.core.steps.StepEventBus.testStarted(StepEventBus.java:142)
at net.thucydides.junit.listeners.JUnitStepListener.testStarted(JUnitStepListener.java:80)
at net.thucydides.junit.listeners.JUnitStepListener.startTestIfNotYetStarted(JUnitStepListener.java:136)
at net.thucydides.junit.listeners.JUnitStepListener.testFailure(JUnitStepListener.java:117)
at org.junit.runner.notification.SynchronizedRunListener.testFailure(SynchronizedRunListener.java:63)
at org.junit.runner.notification.RunNotifier$4.notifyListener(RunNotifier.java:142)
at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
at org.junit.runner.notification.RunNotifier.fireTestFailures(RunNotifier.java:138)
at org.junit.runner.notification.RunNotifier.fireTestFailure(RunNotifier.java:132)
at org.junit.internal.runners.model.EachTestNotifier.addFailure(EachTestNotifier.java:23)
at org.junit.runners.ParentRunner.run(ParentRunner.java:369)
at net.serenitybdd.junit.runners.SerenityRunner.run(SerenityRunner.java:252)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

 


N
Ninad Shivaji Kambli Replied on 17/08/2019

There was issue with POM.xml maven file. I downloaded below file from internet and it works fine.

<?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>net.serenitybdd.starter</groupId>
<artifactId>serenity-rest-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Sample Serenity BDD project using Cucumber</name>

<!-- Used for the sample Springboot web service -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<serenity.version>2.0.66</serenity.version>
<serenity.maven.version>2.0.66</serenity.maven.version>
<serenity.cucumber.version>1.0.18</serenity.cucumber.version>
<cucumber.version>4.2.0</cucumber.version>
<logback.version>1.2.3</logback.version>
<encoding>UTF-8</encoding>
<tags></tags>
<parallel.tests>4</parallel.tests>
<webdriver.base.url></webdriver.base.url>
</properties>

<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray-plugins</name>
<url>http://jcenter.bintray.com</url>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!--
- To use Cucumber 4, exclude the old Cucumber 2 cucumber-core dependency from the serenity-core dependency
- and include the Cucumber 4 cucumber-java and cucumber-junit dependencies.
-->
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-rest-assured</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-screenplay</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-screenplay-rest</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-cucumber4</artifactId>
<version>${serenity.cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>


</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/Test*.java</include>
<include>**/*TestSuite.java</include>
<include>**/When*.java</include>
</includes>
<systemPropertyVariables>
<webdriver.base.url>${webdriver.base.url}</webdriver.base.url>
</systemPropertyVariables>
<parallel>classes</parallel>
<threadCount>${parallel.tests}</threadCount>
<forkCount>${parallel.tests}</forkCount>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.maven.version}</version>
<configuration>
<tags>${tags}</tags>
</configuration>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>