Skip to content

Commit 2a9df73

Browse files
committed
MQE-1782: MFTF run:group can't run test in a suite
- Fixed mixed group/suite usecase - Added Unit test
1 parent 09d8bfd commit 2a9df73

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Console/BaseGenerateCommandTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,28 @@ public function testTwoTestTwoSuiteOneGroupConfig()
129129
$this->assertEquals($expected, $actual);
130130
}
131131

132+
/**
133+
* Test specific usecase of a test that is in a group with the group being called along with the suite
134+
* i.e. run:group Group1 Suite1
135+
* @throws \Exception
136+
*/
137+
public function testThreeTestOneSuiteOneGroupMix()
138+
{
139+
$testOne = new TestObject('Test1', [], [], []);
140+
$testTwo = new TestObject('Test2', [], [], []);
141+
$testThree = new TestObject('Test3', [], ['group' => ['Group1']], []);
142+
$suiteOne = new SuiteObject('Suite1', ['Test1' => $testOne, 'Test2' => $testTwo, 'Test3' => $testThree], [], []);
143+
144+
$testArray = ['Test1' => $testOne, 'Test2' => $testTwo, 'Test3' => $testThree];
145+
$suiteArray = ['Suite1' => $suiteOne];
146+
147+
$this->mockHandlers($testArray, $suiteArray);
148+
149+
$actual = json_decode($this->callGroupConfig(['Group1', 'Suite1']), true);
150+
$expected = ['tests' => null, 'suites' => ['Suite1' => []]];
151+
$this->assertEquals($expected, $actual);
152+
}
153+
132154
/**
133155
* Mock handlers to skip parsing
134156
* @param array $testArray

src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ protected function getGroupAndSuiteConfiguration(array $groupOrSuiteNames)
148148

149149
foreach ($testsInGroupAndInAnySuite as $testInGroupAndInAnySuite) {
150150
$suiteName = $testsInSuites[$testInGroupAndInAnySuite][0];
151+
if (isset($result['suites'][$suiteName])) {
152+
// Suite is already being called to run in its entirety, do not filter list
153+
continue;
154+
}
151155
$result['suites'][$suiteName][] = $testInGroupAndInAnySuite;
152156
}
153157

0 commit comments

Comments
 (0)