The getTestMethod method in the io.qameta.allure.junitplatform.AllureJunitPlatformUtils class doesn't function as expected for tests that are inherited. This is because it uses aClass.getDeclaredMethods(), which only operates on the current instance and does not include methods that are inherited. This can cause issues with annotations related to methods, such as descriptions and others.
Revision 1
In this revision, I used the aClass.getMethods() that returns all public methods on a checking class.
Revision 2
However, revision 1 covers one of the test cases when all test methods are public. It doesn't work when:
Methods have package-based visibility that is usually for unit tests.
public abstract static class ParentTest implements GrandparentTest {
@Test
@Description(TEST_DESCRIPTION)
@Story(INHERITED_TEST_PARENT_STORY)
@Link(TEST_LINK)
void parentTest() {}
}
Methods are members of the interface (as default methods).
Parent class has an upper-class annotation that must be applied to all inheritors.
@Epic(INHERITED_TEST_EPIC)
@Feature(INHERITED_TEST_FUTURE)
public interface GrandparentTest { }
In short, I have to implement two methods placed into ReflectionUtils to recursively collect method and annotation information. These methods are designed as simplified logic of org.springframework.data.util.ReflectionUtils specifically for our needs.
fixes #1032
Context
The
getTestMethod
method in theio.qameta.allure.junitplatform.AllureJunitPlatformUtils
class doesn't function as expected for tests that are inherited. This is because it usesaClass.getDeclaredMethods()
, which only operates on the current instance and does not include methods that are inherited. This can cause issues with annotations related to methods, such as descriptions and others.Revision 1
In this revision, I used the
aClass.getMethods()
that returns all public methods on a checking class.Revision 2
However, revision 1 covers one of the test cases when all test methods are public. It doesn't work when:
In short, I have to implement two methods placed into
ReflectionUtils
to recursively collect method and annotation information. These methods are designed as simplified logic oforg.springframework.data.util.ReflectionUtils
specifically for our needs.Checklist