0

I am using JBehave+Selenium+Serenity+Maven. Despite the fact that JBehave runs correctly and I get results, the Serenity report comes empty.

Generating reports view to 'C:\Users\neos\workspace\project\target\jbehave' using formats '[stats, console, txt, html, stats, junitscenarioreporter]' and view properties '{navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
Reports view generated with 3 stories (of which 0 pending) containing 2 scenarios (of which 0 pending)
Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.415 sec

Results :

Tests run: 14, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ CHESAR3 ---
[INFO] Building jar: C:\Users\neos\workspace\project\target\CHESAR3-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- serenity-maven-plugin:1.1.21:aggregate (serenity-reports) @ CHESAR3 ---
Merging requirements = []
Merging requirements = []
Merged requirements set = []
[INFO] REPORTS GENERATED IN C:\Users\neos\workspace\project\target\site\serenity
[INFO] REPORT HOME PAGE: C:\Users\neos\workspace\project\target\site\serenity\index.html
[INFO] Generating release reports for: []
GENERATE CUSTOM REPORTS
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.971 s
[INFO] Finished at: 2016-06-16T17:05:07+03:00
[INFO] Final Memory: 23M/295M
[INFO] -------------------------------------

Please bear in mind that I have done the: public class RunTest extends SerenityStories{

Please find below my pom.xml:

<build>

    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
                <includes>
                    <include>RunTest.java</include>
                </includes>
            </configuration>
        </plugin>

        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.maven.version}</version>
            <dependencies>
                <dependency>
                    <groupId>net.serenity-bdd</groupId>
                    <artifactId>serenity-core</artifactId>
                    <version>${serenity.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>serenity-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>${serenity.version}</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-jbehave</artifactId>
        <version>${serenity.jbehave.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.5</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.5</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.0</version>
    </dependency>
</dependencies>

Stories are recorded into the report but with 0 results VIEW REPORT

Cœur
  • 37,241
  • 25
  • 195
  • 267
Petros
  • 11
  • 1
  • 5

1 Answers1

0

EDIT your modified POM.XML just run mvn clean verify command after adding below:

<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>CHESAR3</groupId>
    <artifactId>CHESAR3</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <serenity.version>1.1.21</serenity.version>
        <serenity.maven.version>1.1.21</serenity.maven.version>
        <webdriver.driver>firefox</webdriver.driver>
        <serenity.jbehave.version>1.13.0</serenity.jbehave.version>
    </properties>

    <build>

        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <includes>
                        <includesFile>**/*RunTest.java</includesFile>
                    </includes>
                </configuration>
            </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>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-junit</artifactId>
            <version>${serenity.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-jbehave</artifactId>
            <version>${serenity.jbehave.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.53.0</version>
        </dependency>
    </dependencies>
</project>
Mrunal Gosar
  • 4,595
  • 13
  • 48
  • 71
  • I have this plug-in. I do not know what is wrong. I am going to add in the description of the issue the pom.xml – Petros Jun 17 '16 at 09:00
  • can u post a sample project to recreate ur issue to github and we can have a look at it – Mrunal Gosar Jun 17 '16 at 09:10
  • Is my pom.xml ok? Do I have to do something else in order to see Serenity the stories of Jbehave? – Petros Jun 17 '16 at 10:30
  • Not sure though..I am trying at my end..If you had small project which you could share to re-create this issue..then that would be much easier – Mrunal Gosar Jun 17 '16 at 10:36
  • lets find out once u can share project – Mrunal Gosar Jun 17 '16 at 11:20
  • Hey I had been through your git project and been able to run it and generate reports (although tests couldn't run because of failures).. I have send a pull request to that project check it..and come back with queries. – Mrunal Gosar Jun 19 '16 at 16:44
  • For some reason I am not able to send push request to your project so I have added the POM.xml file here – Mrunal Gosar Jun 19 '16 at 16:56
  • Still I get empty reports "0 test scenarios". I modified as you said into "**/*RunTest.java" at POM.XML. However, I do not add the below lines: maven-surefire-plugin 2.19.1 true because when I added it, tests cannot run – Petros Jun 21 '16 at 08:12
  • tests will run from failsafe plugin instead of surefire plugin..surefire exits the moment tests fail..failsafe continues though..place the above POM.xml file as is and try to run mvn clean verify command you would see reports getting generated in target folder -> site -> serenity -> index.html – Mrunal Gosar Jun 21 '16 at 08:33
  • When I used the above pom nothing runs. Driver is not opened the browser at all and nothing happens. With clean verify i get: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project CHESAR3: with verify only i get a lot of errors too. – Petros Jun 21 '16 at 08:57
  • I managed to run it but again emtpy reports. In console: Tests run: 14, Failures: 0, Errors: 0, Skipped: 0 [INFO] project.reporting.OutputDirectory : null [INFO] project.reporting.OutputDirectory : null [INFO] OutputDirectory : C:\Users\workspace\CHESAR3\target\site\serenity Merging requirements = [] Merging requirements = [] Merged requirements set = [] [INFO] REPORTS GENERATED IN C:\Users\workspace\\CHESAR3\target\site\serenity [INFO] REPORT HOME PAGE: C:\Users\workspace\CHESAR3\target\site\serenity\index.html [INFO] Generating release reports for: [] GENERATE CUSTOM REPORTS – Petros Jun 21 '16 at 09:19
  • well..there you go..reports did got generated right..wasn't that original issue..about content not appearing (like your tests not appearing in report)..we will have to look at your serenity implementations – Mrunal Gosar Jun 21 '16 at 10:49
  • However, please note that JBehave report and results produced properly – Petros Jun 22 '16 at 07:59
  • Stories are appeared in serenity report normally. But report has only 0 – Petros Jun 23 '16 at 14:43
  • Mate well it seems at my end this tests are not running so I may not be able troubleshoot..If you could replicate this on a public URL with sample project then I maybe able to troubleshoot – Mrunal Gosar Jun 25 '16 at 14:09