allure-framework / allure-java

Allure integrations for Java test frameworks
Apache License 2.0
355 stars 224 forks source link

fix(descriptions-javadoc): put descriptions in META-INF folder #971

Closed rPraml closed 11 months ago

rPraml commented 11 months ago

Context

We have a multi module project, where we have a "commons-junit" maven module. The "commons-junit" module provides some basic tests in an abstract class, that other modules can can (re)use. Now we want to add module-infos in all our modules and we come across the problem, that allure-descriptions-javadoc puts the descriptions in the folder allureDescriptions.

As this looks like a package, we get the jpms split package situation and get the error

Package allureDescriptions in both module A and module B

This PR changes the destination from allureDescriptions to META-INF/allureDescriptions as suggested here https://stackoverflow.com/questions/69526033/how-to-add-resources-to-two-modular-jars-in-same-named-folders

This will solve our problem, but I cannot estimate, if there are thirdParty frameworks, that rely on the folder location

Example use case

Content of the "commons-junit" module

public abstract class BasicArchitectureTest {
    /**
     * Tests for correct test class names (uses com.tngtech.archunit).
     */
    @Test
    @Description(useJavaDoc = true)
    public void testTestClassNames() {
        testClasses()
                .should()
                .haveSimpleNameEndingWith("Test")
                .orShould()
                .haveSimpleNameEndingWith("IT") // covers also UIT
                .check(SRC_TEST_JAVA);
    }
}

Content of other module (depends on commons-junit)

public class CoreCommonsJunitArchitectureTest extends BasicArchitectureTest {
        // execute all tests in this module provided by BasicArchitectureTest 

        /**
     * module specific architecture tests
     */
    @Test
    @Description(useJavaDoc = true)
    public void testFoo() {
            ...
        }
}

Checklist

baev commented 11 months ago

@rPraml thanks!