-
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.
Merge pull request #1475 from juherr/issue-#288
Add test case for #288
- Loading branch information
Showing
5 changed files
with
88 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package test.order; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.testng.annotations.Test; | ||
import test.InvokedMethodNameListener; | ||
import test.SimpleBaseTest; | ||
import test.order.github288.Actual1Sample; | ||
import test.order.github288.Actual2Sample; | ||
|
||
public class OrderTest extends SimpleBaseTest { | ||
|
||
@Test(description = "GITHUB-288") | ||
public void interleavingMethodsInDifferentClasses() { | ||
InvokedMethodNameListener listener = run(Actual1Sample.class, Actual2Sample.class); | ||
assertThat(listener.getFailedMethodNames()).isEmpty(); | ||
assertThat(listener.getSkippedMethodNames()).isEmpty(); | ||
assertThat(listener.getSucceedMethodNames()).containsExactly( | ||
"beforeClass", | ||
"test1", | ||
// "test3", // The result is not exactly the one from #288 (prior 6.8) | ||
// but it respects the class separation | ||
"test4(one)", | ||
"test4(two)", | ||
"test4(three)", | ||
"test4(four)", | ||
"test3", | ||
"afterClass", | ||
"beforeClass", | ||
"test2", | ||
"afterClass" | ||
); | ||
} | ||
|
||
} |
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,28 @@ | ||
package test.order.github288; | ||
|
||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
|
||
|
||
public class Actual1Sample extends BaseSample { | ||
|
||
@DataProvider | ||
public Object[][] parameters() { | ||
return new Object[][]{ | ||
new Object[]{"one"}, | ||
new Object[]{"two"}, | ||
new Object[]{"three"}, | ||
new Object[]{"four"} | ||
}; | ||
} | ||
|
||
@Test | ||
public void test1() { } | ||
|
||
@Test(dependsOnMethods = "test1") | ||
public void test3() { } | ||
|
||
@Test(dataProvider = "parameters") | ||
public void test4(String parameter) { } | ||
|
||
} |
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,10 @@ | ||
package test.order.github288; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
public class Actual2Sample extends BaseSample { | ||
|
||
@Test | ||
public void test2() { } | ||
|
||
} |
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,14 @@ | ||
package test.order.github288; | ||
|
||
import org.testng.annotations.AfterClass; | ||
import org.testng.annotations.BeforeClass; | ||
|
||
public class BaseSample { | ||
|
||
@BeforeClass | ||
protected void beforeClass() { } | ||
|
||
@AfterClass(alwaysRun = true) | ||
protected void afterClass() { } | ||
|
||
} |
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