Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BeforeGroups should run before any matched test
- Loading branch information
Showing
6 changed files
with
123 additions
and
27 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
21 changes: 21 additions & 0 deletions
21
testng-core/src/test/java/test/beforegroups/issue2359/ListenerAdapter.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.beforegroups.issue2359; | ||
|
||
import java.util.Collection; | ||
import java.util.concurrent.ConcurrentLinkedQueue; | ||
import org.testng.ITestResult; | ||
import org.testng.TestListenerAdapter; | ||
|
||
public class ListenerAdapter extends TestListenerAdapter { | ||
|
||
private final Collection<ITestResult> passedConfiguration = new ConcurrentLinkedQueue<>(); | ||
|
||
@Override | ||
public void onConfigurationSuccess(ITestResult itr) { | ||
super.onConfigurationSuccess(itr); | ||
this.passedConfiguration.add(itr); | ||
} | ||
|
||
public Collection<ITestResult> getPassedConfiguration() { | ||
return passedConfiguration; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
testng-core/src/test/java/test/beforegroups/issue2359/SampleFor2359.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,26 @@ | ||
package test.beforegroups.issue2359; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import org.testng.annotations.BeforeGroups; | ||
import org.testng.annotations.Test; | ||
|
||
public class SampleFor2359 { | ||
|
||
@BeforeGroups(groups = "testng2359") | ||
public void beforeGroup() { | ||
try { | ||
TimeUnit.SECONDS.sleep(2); | ||
} catch (InterruptedException e) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
} | ||
|
||
@Test(groups = "testng2359") | ||
public void sampleTest1() {} | ||
|
||
@Test(groups = "testng2359") | ||
public void sampleTest2() {} | ||
|
||
@Test(groups = "testng2359") | ||
public void sampleTest3() {} | ||
} |