allure-framework / allure-java

Allure integrations for Java test frameworks
Apache License 2.0
341 stars 218 forks source link

🐞: Inherited test methods don't support their annotations. #1032

Open ingvard opened 2 months ago

ingvard commented 2 months ago

What happened?

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.

What Allure Integration are you using?

allure-junit-platform

Steps to Reproduce

  1. Create two test classes:
    
    abstract class AbstractTest {
    @Test
    @Description("Test description")
    fun test() {
    }
    }

class ImplTest: AbstractTest() { }


2. Run `ImplTest`.
3. Check the description in the Allure UI.

### Expected Behaviour

The test should contain the `"Test description"` text in the description section.

### Screenshots or Additional Context

The description is absent.

### What Language are you using?

Java, Kotlin

### What version of Allure Integration you are using?

2.27.0

### What version of Allure Report you are using?

2.11.2

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct