File tree Expand file tree Collapse file tree 5 files changed +69
-0
lines changed Expand file tree Collapse file tree 5 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ package test .cli .github2974 ;
2+
3+ import java .util .List ;
4+ import org .testng .Assert ;
5+ import org .testng .CommandLineArgs ;
6+ import org .testng .TestNG ;
7+ import org .testng .annotations .Test ;
8+ import test .SimpleBaseTest ;
9+
10+ public class OverrideGroupsCliTest extends SimpleBaseTest {
11+
12+ @ Test (description = "GITHUB-2974" )
13+ public void overrideGroupsFromCliInParentChildXml () {
14+ TestNG testNG =
15+ new TestNG (false ) {
16+ {
17+ CommandLineArgs args = new CommandLineArgs ();
18+ args .groups = "override_group" ;
19+ args .suiteFiles = List .of (getPathToResource ("2974/parent.xml" ));
20+ configure (args );
21+ }
22+ };
23+ testNG .run ();
24+ Assert .assertTrue (TwoGroupsTest .NAMES .contains ("must run" ));
25+ Assert .assertFalse (TwoGroupsTest .NAMES .contains ("must not run" ));
26+ }
27+ }
Original file line number Diff line number Diff line change 1+ package test .cli .github2974 ;
2+
3+ import java .util .ArrayList ;
4+ import java .util .List ;
5+ import org .testng .annotations .Test ;
6+
7+ public class TwoGroupsTest {
8+
9+ public static final List <String > NAMES = new ArrayList <>();
10+
11+ @ Test (groups = {"override_group" })
12+ public void test1 () {
13+ NAMES .add ("must run" );
14+ }
15+
16+ @ Test (groups = {"default_group" })
17+ public void test2 () {
18+ NAMES .add ("must not run" );
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ <!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
2+ <suite name =" child" >
3+
4+ <test name =" Tests inherit groups from parent xml" >
5+ <classes >
6+ <class name =" test.cli.github2974.TwoGroupsTest" />
7+ </classes >
8+ </test >
9+ </suite >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
2+ <suite name =" parent suite with default group" parallel =" methods" thread-count =" 1" >
3+
4+ <groups >
5+ <run >
6+ <include name =" default_group" />
7+ </run >
8+ </groups >
9+ <suite-files >
10+ <suite-file path =" child.xml" />
11+ </suite-files >
12+ </suite >
Original file line number Diff line number Diff line change 109109 <class name =" test.github765.ExcludeSyntheticMethodsFromTemplateCallsTest" />
110110 <class name =" test.github1405.TestExclusionOfMainMethod" />
111111 <class name =" test.cli.CliTest" />
112+ <class name =" test.cli.github2974.OverrideGroupsCliTest" />
112113 <class name =" test.thread.ParallelSuiteTest" />
113114 <class name =" test.simple.IncludedExcludedTest" />
114115 <class name =" test.reports.ReportTest" />
You can’t perform that action at this time.
0 commit comments