allure-framework / allure2

Allure Report is a flexible, lightweight multi-language test reporting tool. It provides clear graphical reports and allows everyone involved in the development process to extract the maximum of information from the everyday testing process
https://allurereport.org/
Apache License 2.0
4.06k stars 702 forks source link

Lack of documentation on report grouping for Cucumber JVM in Allure #1530

Closed sgkiokas closed 10 months ago

sgkiokas commented 2 years ago

Pre-check

Describe the improvement

I'd like to report

Description of the improvement / report We have a repo hosting some e2e tests that are written in Java using Cucumber. The TestRunner has been implemented like this:

public static void main(String[] args) throws Exception {
        Properties prop = new Properties();
        InputStream config = new FileInputStream(System.getProperty("user.dir") + "/src/test/resources/properties/config.properties");
        prop.load(config);
        String val = System.getProperty("parallel") != null ? System.getProperty("parallel") : prop.getProperty("PARALLEL");
        boolean parallel = Boolean.parseBoolean(val);
        val = System.getProperty("threadCount") != null ? System.getProperty("threadCount") : prop.getProperty("THREAD_COUNT");

        int threadCount = Integer.parseInt(val);

        TestNG testSuite = new TestNG();
        testSuite.setTestClasses(new Class[]{TestRunner.class});
        testSuite.setVerbose(0);

        if (parallel) {
            System.out.println("Parallel: ON");
            System.out.println("Thread Count: " + threadCount);
            testSuite.setDataProviderThreadCount(threadCount);
        } else {
            System.out.println("Parallel: OFF");
            testSuite.setDataProviderThreadCount(1);
        }

        testSuite.setUseDefaultListeners(false);
        testSuite.run();

        if (testSuite.getStatus() == 1 || testSuite.hasFailure()) {
            throw new Exception("Test Suite Failed.");
        }
    }

Trying to use the relevant testng maven plugin along with aspectj like this:

<dependency>
      <groupId>ru.yandex.qatools.allure</groupId>
      <artifactId>allure-testng</artifactId>
      <version>1.3.9</version>
      <type>pom</type>
 </dependency>
<dependency>
     <groupId>org.aspectj</groupId>
     <artifactId>aspectjweaver</artifactId>
      <version>1.9.8.RC3</version>
</dependency>

However, the Allure report is not generated. If I use the following

<dependency>
     <groupId>io.qameta.allure</groupId>
     <artifactId>allure-cucumber4-jvm</artifactId>
     <version>2.16.1</version>
</dependency>

along with the amendment of the CucumberOptions like:

plugin = {
        "pretty",
        "html:target/cucumber-report/com.tenx.test",
        "junit:target/cucumber-report/Cucumber.xml",
        "com.tenx.bdd.CucumberFormatter.TenxCucumberCustomFormatter:target/cucumber-report/Cucumber.json",
        "rerun:target/rerun.txt",
        "io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm"
    })

I get the report.

My problem is that I cannot customise the report grouping in order to properly map them in the respective areas and domains. I tried Epics, Stories and Features tags by importing the relevant library with no luck.

I also looked at this grouping ability provided via NUnit3 which seems closer to what I want to achieve.

However, it seems that there is a lack of documentation on how this can be done.

Could you please point me to these docs or describe how the above can be completed?

Thanks!

P.S.: Unfortunately git doesn't let me to upload a screenshot. Essentially, what I'm looking for is a structure like the following:

Area
    Domain
         Feature File Name
             Scenario Name
baev commented 10 months ago

The documentation for Cucumber-JVM has just been released. Check it out https://allurereport.org/docs/cucumberjvm/

Feel free to submit feedback via GitHub Discussions