-
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.
Report deadlocks when running in sharedthreadpool
Closes #3028
- Loading branch information
1 parent
43af2cf
commit 459000b
Showing
7 changed files
with
167 additions
and
3 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
8 changes: 8 additions & 0 deletions
8
testng-core-api/src/main/java/org/testng/TestNGDeadLockException.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,8 @@ | ||
package org.testng; | ||
|
||
/** Represents a dead lock condition in TestNG wherein execution can get stalled. */ | ||
public class TestNGDeadLockException extends TestNGException { | ||
public TestNGDeadLockException(String string) { | ||
super(string); | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
testng-core/src/test/java/test/thread/issue3028/AnotherDataDrivenTestSample.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,30 @@ | ||
package test.thread.issue3028; | ||
|
||
import org.testng.ITestResult; | ||
import org.testng.Reporter; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
|
||
public class AnotherDataDrivenTestSample { | ||
|
||
@Test(dataProvider = "dp") | ||
public void a(int ignored) { | ||
log(); | ||
} | ||
|
||
@Test(dataProvider = "dp") | ||
public void b(int ignored) { | ||
log(); | ||
} | ||
|
||
private void log() { | ||
ITestResult itr = Reporter.getCurrentTestResult(); | ||
long id = Thread.currentThread().getId(); | ||
Reporter.log("Running " + itr.toString() + " on Thread " + id); | ||
} | ||
|
||
@DataProvider(name = "dp", parallel = true) | ||
public Object[][] getData() { | ||
return new Object[][] {{1}, {2}, {3}, {4}, {5}}; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
testng-core/src/test/java/test/thread/issue3028/DataDrivenTestSample.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,29 @@ | ||
package test.thread.issue3028; | ||
|
||
import org.testng.ITestResult; | ||
import org.testng.Reporter; | ||
import org.testng.annotations.*; | ||
|
||
public class DataDrivenTestSample { | ||
|
||
@Test(dataProvider = "dp") | ||
public void a(int ignored) { | ||
log(); | ||
} | ||
|
||
@Test(dataProvider = "dp") | ||
public void b(int ignored) { | ||
log(); | ||
} | ||
|
||
private void log() { | ||
ITestResult itr = Reporter.getCurrentTestResult(); | ||
long id = Thread.currentThread().getId(); | ||
Reporter.log("Running " + itr.toString() + " on Thread " + id); | ||
} | ||
|
||
@DataProvider(name = "dp", parallel = true) | ||
public Object[][] getData() { | ||
return new Object[][] {{1}, {2}, {3}, {4}, {5}}; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
testng-core/src/test/java/test/thread/issue3028/FactoryPoweredDataDrivenTestSample.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,38 @@ | ||
package test.thread.issue3028; | ||
|
||
import org.testng.ITestResult; | ||
import org.testng.Reporter; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Factory; | ||
import org.testng.annotations.Test; | ||
|
||
public class FactoryPoweredDataDrivenTestSample { | ||
|
||
@Factory | ||
public static Object[] objects() { | ||
return new Object[] { | ||
new FactoryPoweredDataDrivenTestSample(), new FactoryPoweredDataDrivenTestSample() | ||
}; | ||
} | ||
|
||
@Test(dataProvider = "dp") | ||
public void a(int ignored) { | ||
log(); | ||
} | ||
|
||
@Test(dataProvider = "dp") | ||
public void b(int ignored) { | ||
log(); | ||
} | ||
|
||
private void log() { | ||
ITestResult itr = Reporter.getCurrentTestResult(); | ||
long id = Thread.currentThread().getId(); | ||
Reporter.log("Running " + itr.toString() + " on Thread " + id); | ||
} | ||
|
||
@DataProvider(name = "dp", parallel = true) | ||
public Object[][] getData() { | ||
return new Object[][] {{1}, {2}, {3}, {4}, {5}}; | ||
} | ||
} |