Inherit annotations for nested classes (junit5)
I'm submitting a ...
- [ ] bug report
- [x] feature request
- [ ] support request => Please do not submit support request here, see note at the top of this template.
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
What is the expected behavior?
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
| Allure version | 2.13.0 |
|---|---|
| Test framework | [email protected] |
| Allure integration | [email protected] |
| Generate report using | [email protected] |
Other information
Hello, is there some work in progress on this issue? This one might be very helpful in our test cases
@Ielay, could you please provide additional details on your use cases?
We are using JUnit5 as a testing framework along with allure to document our test cases.
The story is mostly about tests on Spring controller layer classes. One day we realised that they became too huge to maintain (too much tests within a single class, too much utility methods and most of them not general/not applicable to each test case). So we decided to split each class tests into nested classes, each class is for one Feature, like the following:
Before:
@Epic(...)
class EntityXController {
@Test
@Feature(Feat1)
void feat1_test1() {...}
...
@Test
@Feature(Feat1)
void feat1_testN1() {...}
...
@Test
@Feature(FeatM)
void featM_test1() {...}
...
@Test
@Feature(FeatM)
void featM_testNM() {...}
}
After:
@Epic(...)
class EntityXController {
@Nested
@Feature(Feat1)
class Feature1 {
@Test
void feat1_test1() {...}
...
@Test
void feat1_testN1() {...}
}
...
@Nested
@Feature(FeatN)
class FeatureN {
@Test
void featM_test1() {...}
...
@Test
void featM_testNM() {...}
}
}
But after that we realised that we must provide Epic info on each nested class. And that leads to code duplicity and there is a chance to forget to put the annotation on some nested class. So it would be really nice to have a possibility to put the annotation only on enclosing class.
I would also like the Epic annotation to be inherited by nested classes
If you are interested in the issue, don't forget to put the vote on (👍). Issues with the most votes have much more attention from the team.
Really want to merge DisplayName annotation. Example:
@DisplayName("Admin Page")
public class AdminPageTests {
@Nested
@DisplayName("Subjects")
class Subjects {
...
}
}
This code should generate nested suites in report or generate its name like this: "Admin Page" > "Subjects", not "Subjects"