forked from testng-team/testng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Streamline dataprovider invoking in abstract classes
Closes testng-team#2800
- Loading branch information
1 parent
8a34c03
commit a810c4d
Showing
7 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
testng-core/src/test/java/test/dataprovider/issue2800/AbstractTestClassGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package test.dataprovider.issue2800; | ||
|
||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Factory; | ||
|
||
public abstract class AbstractTestClassGenerator { | ||
|
||
@DataProvider(name = "dataProvider") | ||
public Object[][] dataProvider() { | ||
return new Object[][] {{"foo"}, {"bar"}}; | ||
} | ||
|
||
@Factory(dataProvider = "dataProvider") | ||
public Object[] testFactory(String value) { | ||
return new Object[] {new TestClassSample()}; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
testng-core/src/test/java/test/dataprovider/issue2800/TestClassGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package test.dataprovider.issue2800; | ||
|
||
public class TestClassGenerator extends AbstractTestClassGenerator {} |
9 changes: 9 additions & 0 deletions
9
testng-core/src/test/java/test/dataprovider/issue2800/TestClassSample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package test.dataprovider.issue2800; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
public class TestClassSample { | ||
|
||
@Test | ||
public void hi() {} | ||
} |