-
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.
#2974: Add overrideGroupsFromCliInParentChildXml test
- Loading branch information
dr29abrt
committed
Aug 31, 2023
1 parent
91a003a
commit 57af52c
Showing
5 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
testng-core/src/test/java/test/cli/github2974/OverrideGroupsCliTest.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,27 @@ | ||
package test.cli.github2974; | ||
|
||
import java.util.List; | ||
import org.testng.Assert; | ||
import org.testng.CommandLineArgs; | ||
import org.testng.TestNG; | ||
import org.testng.annotations.Test; | ||
import test.SimpleBaseTest; | ||
|
||
public class OverrideGroupsCliTest extends SimpleBaseTest { | ||
|
||
@Test(description = "GITHUB-2974") | ||
public void overrideGroupsFromCliInParentChildXml() { | ||
TestNG testNG = | ||
new TestNG(false) { | ||
{ | ||
CommandLineArgs args = new CommandLineArgs(); | ||
args.groups = "override_group"; | ||
args.suiteFiles = List.of(getPathToResource("2974/parent.xml")); | ||
configure(args); | ||
} | ||
}; | ||
testNG.run(); | ||
Assert.assertTrue(TwoGroupsTest.NAMES.contains("must run")); | ||
Assert.assertFalse(TwoGroupsTest.NAMES.contains("must not run")); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
testng-core/src/test/java/test/cli/github2974/TwoGroupsTest.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,20 @@ | ||
package test.cli.github2974; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.testng.annotations.Test; | ||
|
||
public class TwoGroupsTest { | ||
|
||
public static final List<String> NAMES = new ArrayList<>(); | ||
|
||
@Test(groups = {"override_group"}) | ||
public void test1() { | ||
NAMES.add("must run"); | ||
} | ||
|
||
@Test(groups = {"default_group"}) | ||
public void test2() { | ||
NAMES.add("must not run"); | ||
} | ||
} |
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 @@ | ||
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd"> | ||
<suite name="child"> | ||
|
||
<test name="Tests inherit groups from parent xml"> | ||
<classes> | ||
<class name="test.cli.github2974.TwoGroupsTest"/> | ||
</classes> | ||
</test> | ||
</suite> |
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,12 @@ | ||
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd"> | ||
<suite name="parent suite with default group" parallel="methods" thread-count="1"> | ||
|
||
<groups> | ||
<run> | ||
<include name="default_group"/> | ||
</run> | ||
</groups> | ||
<suite-files> | ||
<suite-file path="child.xml"/> | ||
</suite-files> | ||
</suite> |
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