Skip to content

Commit 5b7eb65

Browse files
committed
MQE-893: Add flag to robo generate: tests which accepts a specific set of tests to execute
- add support for excluded test and suite generation based on config
1 parent 4f847dd commit 5b7eb65

File tree

6 files changed

+19
-7
lines changed

6 files changed

+19
-7
lines changed

bin/static-checks

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -e
88
echo "==============================="
99
echo " CODE SNIFFER"
1010
echo "==============================="
11-
vendor/bin/phpcs ./src --standard=./dev/tests/static/Magento
11+
vendor/bin/phpcs ./src --standard=./dev/tests/static/Magento --ignore=src/Magento/FunctionalTestingFramework/Group,src/Magento/FunctionalTestingFramework/AcceptanceTester.php
1212
vendor/bin/phpcs ./dev/tests/unit --standard=./dev/tests/static/Magento
1313
vendor/bin/phpcs ./dev/tests/verification --standard=./dev/tests/static/Magento --ignore=dev/tests/verification/_generated
1414
echo ""
@@ -22,7 +22,7 @@ echo ""
2222
echo "==============================="
2323
echo " MESS DETECTOR"
2424
echo "==============================="
25-
vendor/bin/phpmd ./src text /dev/tests/static/Magento/CodeMessDetector/ruleset.xml --exclude _generated
25+
vendor/bin/phpmd ./src text /dev/tests/static/Magento/CodeMessDetector/ruleset.xml --exclude _generated,src/Magento/FunctionalTestingFramework/Group,src/Magento/FunctionalTestingFramework/AcceptanceTester.php
2626
echo ""
2727

2828
echo "==============================="

bin/static-checks.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
@echo off
77
@echo ===============================PHP CODE SNIFFER REPORT===============================
8-
call vendor\bin\phpcs .\src --standard=.\dev\tests\static\Magento
8+
call vendor\bin\phpcs .\src --standard=.\dev\tests\static\Magento --ignore=src\Magento\FunctionalTestingFramework\Group,src\Magento\FunctionalTestingFramework\AcceptanceTester.php
99
call vendor\bin\phpcs .\dev\tests\unit --standard=.\dev\tests\static\Magento
1010
call vendor\bin\phpcs .\dev\tests\verification --standard=.\dev\tests\static\Magento --ignore=dev\tests\verification\_generated
1111

1212
@echo ===============================COPY PASTE DETECTOR REPORT===============================
1313
call vendor\bin\phpcpd .\src
1414

1515
@echo "===============================PHP MESS DETECTOR REPORT===============================
16-
vendor\bin\phpmd .\src text \dev\tests\static\Magento\CodeMessDetector\ruleset.xml --exclude _generated
16+
vendor\bin\phpmd .\src text \dev\tests\static\Magento\CodeMessDetector\ruleset.xml --exclude _generated,src\Magento\FunctionalTestingFramework\Group,src\Magento\FunctionalTestingFramework\AcceptanceTester.php
1717

1818
@echo ===============================MAGENTO COPYRIGHT REPORT===============================
1919
echo msgbox "INFO:Copyright check currently not run as part of .bat implementation" > "%temp%\popup.vbs"

src/Magento/FunctionalTestingFramework/Util/Manifest/BaseTestManifest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ abstract public function generate();
7979
*/
8080
public function getSuiteConfig()
8181
{
82-
$suiteToTestNames = [];
82+
if ($this->suiteConfiguration === null) {
83+
return [];
84+
}
8385

86+
$suiteToTestNames = [];
8487
if (empty($this->suiteConfiguration)) {
8588
// if there is no configuration passed we can assume the user wants all suites generated as specified.
8689
foreach (SuiteObjectHandler::getInstance()->getAllObjects() as $suite => $suiteObj) {

src/Magento/FunctionalTestingFramework/Util/Manifest/ParallelTestManifest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function createTestGroups($lines)
9999
public function generate()
100100
{
101101
DirSetupUtil::createGroupDir($this->dirPath);
102-
$suites = $this->getFlattenedSuiteConfiguration($this->parallelGroupSorter->getResultingSuiteConfig());
102+
$suites = $this->getFlattenedSuiteConfiguration($this->suiteConfiguration ?? []);
103103

104104
foreach ($this->testGroups as $groupNumber => $groupContents) {
105105
$this->generateGroupFile($groupContents, $groupNumber, $suites);

src/Magento/FunctionalTestingFramework/Util/Sorter/ParallelGroupSorter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public function getTestsGroupedBySize($suiteConfiguration, $testNameToSize, $lin
7676
*/
7777
public function getResultingSuiteConfig()
7878
{
79+
if (empty($this->suiteConfig)) {
80+
return null;
81+
}
82+
7983
return $this->suiteConfig;
8084
}
8185

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private function __construct($exportDir, $tests, $debug = false)
9797
* @param bool $debug
9898
* @return TestGenerator
9999
*/
100-
public static function getInstance($dir = null, $tests = null, $debug = false)
100+
public static function getInstance($dir = null, $tests = [], $debug = false)
101101
{
102102
return new TestGenerator($dir, $tests, $debug);
103103
}
@@ -174,6 +174,11 @@ private function createCestFile($testPhp, $filename)
174174
*/
175175
public function createAllTestFiles($testManifest = null, $testsToIgnore = null)
176176
{
177+
if ($this->tests === null) {
178+
// no-op if the test configuration is null
179+
return;
180+
}
181+
177182
DirSetupUtil::createGroupDir($this->exportDirectory);
178183
if ($testsToIgnore === null) {
179184
$testsToIgnore = SuiteObjectHandler::getInstance()->getAllTestReferences();

0 commit comments

Comments
 (0)