trivago / cluecumber

Clear and concise reporting for the Cucumber BDD JSON format.

Home Page:https://www.softwaretester.blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running Multiple Runners, and generating reports from all runners.

gheeno opened this issue · comments

Description:
As a test developer, I have multiple test runners - simulating different "suites". But when I run the test via mvn clean verify both FPOSTEST and DEMOTEST are executing but only DEMOTEST is being reported on ( Cluecumber report )

Question:
Is there any way, that can I see the generated reports for all the runners that were executed?

TestNg XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Cucumber Framework">
    <test name = "Cucumber Test" verbose="2">
        <classes>
            <class name="com.testrunners.FposTest"/>
            <class name="demo.runnertypes.DemoTest"/>
        </classes>
    </test>
</suite>

FPOSTEST

package com.testrunners;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import cucumber.api.testng.AbstractTestNGCucumberTests;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
        features =  {
                "src/test/java/com/features/fpos/admin",
        },
        glue = {
                "com.stepdefinitions"
        },
        monochrome = true,
        tags =  {
                "@fpos_smoke"
        },
        plugin = {"pretty",
                "html:target/cucumber",
                "json:target/cucumber-report/cucumber.json",
                "json:target/cucumber.json",
                "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter: target/report.html"}
)

public class FposTest extends AbstractTestNGCucumberTests {
}

DEMOTEST

package demo.runnertypes;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import cucumber.api.testng.AbstractTestNGCucumberTests;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
        features =  "src/test/java/demo/features", //feature location
        glue = { "demo.stepdefinitions", "com.stepdefinitions" }, //step definition , master hooks locations
        monochrome = true,
        tags =  {},
        plugin = {"pretty",
                "html:target/cucumber",
                "json:target/cucumber-report/cucumber.json",
                "json:target/cucumber.json",
                "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter: test-output/report.html"}
)

public class DemoTest extends AbstractTestNGCucumberTests {
}

POM.XML

            <plugin>
                <groupId>com.trivago.rta</groupId>
                <artifactId>cluecumber-report-plugin</artifactId>
                <version>${cluecumber-report.version}</version>
                <executions>
                    <execution>
                        <id>report</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>reporting</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceJsonReportDirectory>${project.build.directory}/cucumber-report</sourceJsonReportDirectory>
                    <generatedHtmlReportDirectory>test-report/generated-cluecumber-report</generatedHtmlReportDirectory>
                    <expandBeforeAfterHooks>true</expandBeforeAfterHooks>
                </configuration>
            </plugin>

Hi! Why do you use two json files for each runner?

"json:target/cucumber-report/cucumber.json",
"json:target/cucumber.json"

This seems pretty redundant.
Also, I guess that the second test suite overwrites the json file of the first one since you use the same file for both.

You could try this for the first suite:
"json:target/cucumber-report/cucumber1.json"

and this for the second:
"json:target/cucumber-report/cucumber2.json"

to have both report to separate json files.

Does it work then?

@laxersaz thanks for the review - was working late didnt realize it was the same.
Renaming it to a different .json works.

Amazing support - thank you.