allure-framework / allure-framework/allure2
[TestNG] All Set Up methods are listed in each test case when @Factory is used
- Dominant language
- HTML
- Stars
- 5.5k
- Forks
- 782
- Avg merge
- 2d 33m
- Merged PRs (30d)
- 16
Description
**Describe the bug**
When testNG @Factory is used all set up methods are listed in each test case
**To Reproduce**
Steps to reproduce the behavior:
```
public class FactoryAllureTest {
@TestInstanceParameter
private String testCase;
public FactoryAllureTest(String testCase) {
this.testCase = testCase;
}
@Factory
public Object[] myFactory() {
return new Object[]{new FactoryAllureTest("testCase1"), new FactoryAllureTest("testCase2"), new FactoryAllureTest("testCase3")};
}
@BeforeClass
public void start() {
System.out.println(testCase);
}
@Test
public void simpleTest() {
System.out.println(testCase);
}
}
```
**Expected behavior**
The Set up section must only display configuration methods for the current test.
**Screenshots**

**Environment (please complete the following information):**
| Allure version | 2.13.3 |
| --- | --- |
| Test framework | testng@6.11 |
| Allure adaptor | allure-testng@2.13.3 |
| Generate report using | allure-maven@2.9 |
**Additional context**
This issue is duplicate of [https://github.com/allure-framework/allure-java/issues/350](url) but that one was for Allure so since the issue still exists, I created it for Allure 2
Contributor guide
Research direction
Reproduce the issue with the supplied TestNG example using @Factory and @BeforeClass, then trace how the Allure TestNG adapter builds the report's setup section for each test case. Done means each factory-created test shows only its own configuration methods, with the behavior verified against the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100