-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Streamline dependsOnMethods for configurations
Closes #550
- Loading branch information
1 parent
d7e0bb1
commit 7070b02
Showing
9 changed files
with
229 additions
and
1 deletion.
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
19 changes: 19 additions & 0 deletions
19
testng-core/src/test/java/test/dependent/issue550/ConfigDependencySample.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,19 @@ | ||
package test.dependent.issue550; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
public class ConfigDependencySample { | ||
|
||
@BeforeMethod(dependsOnMethods = "anotherBeforeMethod") | ||
public void beforeMethod() {} | ||
|
||
@BeforeMethod | ||
public void anotherBeforeMethod() throws InterruptedException { | ||
TimeUnit.MILLISECONDS.sleep(100); | ||
} | ||
|
||
@Test | ||
public void testMethod() {} | ||
} |
17 changes: 17 additions & 0 deletions
17
...core/src/test/java/test/dependent/issue550/ConfigDependencyWithMismatchedLevelSample.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.dependent.issue550; | ||
|
||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
public class ConfigDependencyWithMismatchedLevelSample { | ||
|
||
@BeforeClass | ||
public void beforeClass() {} | ||
|
||
@BeforeMethod(dependsOnMethods = "beforeClass") | ||
public void beforeMethod() {} | ||
|
||
@Test | ||
public void testMethod() {} | ||
} |
23 changes: 23 additions & 0 deletions
23
...-core/src/test/java/test/dependent/issue550/ConfigDependsOnTestAndConfigMethodSample.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,23 @@ | ||
package test.dependent.issue550; | ||
|
||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
public class ConfigDependsOnTestAndConfigMethodSample { | ||
|
||
@BeforeClass | ||
public void beforeClass() {} | ||
|
||
@BeforeClass | ||
public void anotherBeforeClass() {} | ||
|
||
@BeforeMethod(dependsOnMethods = {"testMethod", "anotherBeforeMethod"}) | ||
public void beforeMethod() {} | ||
|
||
@BeforeMethod | ||
public void anotherBeforeMethod() {} | ||
|
||
@Test | ||
public void testMethod() {} | ||
} |
13 changes: 13 additions & 0 deletions
13
testng-core/src/test/java/test/dependent/issue550/ConfigDependsOnTestMethodSample.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,13 @@ | ||
package test.dependent.issue550; | ||
|
||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
public class ConfigDependsOnTestMethodSample { | ||
|
||
@BeforeMethod(dependsOnMethods = "testMethod") | ||
public void beforeMethod() {} | ||
|
||
@Test | ||
public void testMethod() {} | ||
} |
21 changes: 21 additions & 0 deletions
21
testng-core/src/test/java/test/dependent/issue550/OrderedResultsGatherer.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,21 @@ | ||
package test.dependent.issue550; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.testng.IInvokedMethod; | ||
import org.testng.IInvokedMethodListener; | ||
import org.testng.ITestResult; | ||
|
||
public class OrderedResultsGatherer implements IInvokedMethodListener { | ||
|
||
List<Long> startTimes = new ArrayList<>(); | ||
|
||
public List<Long> getStartTimes() { | ||
return startTimes; | ||
} | ||
|
||
@Override | ||
public void afterInvocation(IInvokedMethod method, ITestResult testResult) { | ||
startTimes.add(testResult.getStartMillis()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
testng-core/src/test/java/test/dependent/issue550/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,13 @@ | ||
package test.dependent.issue550; | ||
|
||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
public class TestClassSample { | ||
|
||
@Test(dependsOnMethods = "a") | ||
public void b() {} | ||
|
||
@BeforeMethod | ||
public void a() {} | ||
} |