Skip to content

Commit f5d0040

Browse files
committed
MQE-1541: Add option to generate:tests for XSD validation on 'merged files'
1 parent 5e96fb4 commit f5d0040

File tree

8 files changed

+17
-33
lines changed

8 files changed

+17
-33
lines changed

dev/tests/_bootstrap.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
true,
3333
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::UNIT_TEST_PHASE,
3434
true,
35-
false,
36-
false
35+
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::DISABLE_DEBUG_MODE
3736
);
3837

3938
// Load needed framework env params

dev/tests/verification/TestModule/ActionGroup/BasicActionGroup.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@
115115
<see selector=".selector" userInput="{{sameStepKeyAsArg}}" stepKey="arg1" />
116116
</actionGroup>
117117

118-
<actionGroup name="actionGroupWithSkipReadinessActions">
119-
<comment userInput="ActionGroupSkipReadiness" stepKey="skip" skipReadiness="true"/>
120-
</actionGroup>
121-
122118
<actionGroup name="actionGroupWithSectionAndData">
123119
<arguments>
124120
<argument name="content" type="string"/>

dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
</after>
2525
<comment stepKey="basicCommentWithNoData" userInput="{{emptyData.noData}}"/>
2626
<comment stepKey="basicCommentWithDefinitelyNoData" userInput="{{emptyData.definitelyNoData}}"/>
27-
<comment stepKey="ReadinessCheckSkipped" userInput="skipReadiness" skipReadiness="true"/>
2827
<grabValueFrom stepKey="someVarDefinition"/>
2928
<acceptPopup stepKey="acceptPopupKey1"/>
3029
<amOnPage stepKey="amOnPageKey1" url="/test/url"/>

dev/tests/verification/Tests/ActionGroupGenerationTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,6 @@ public function testActionGroupWithArgContainingStepKey()
185185
$this->generateAndCompareTest('ActionGroupContainsStepKeyInArgText');
186186
}
187187

188-
/**
189-
* Test an action group with an arg containing stepKey text
190-
*
191-
* @throws \Exception
192-
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
193-
*/
194-
public function testActionGroupWithSkipReadiness()
195-
{
196-
$this->generateAndCompareTest('ActionGroupSkipReadiness');
197-
}
198-
199188
/**
200189
* Test an action group with an arg containing stepKey text
201190
*

src/Magento/FunctionalTestingFramework/Config/MftfApplicationConfig.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class MftfApplicationConfig
1515
const MFTF_PHASES = [self::GENERATION_PHASE, self::EXECUTION_PHASE, self::UNIT_TEST_PHASE];
1616

1717
const DEFAULT_DEBUG_MODE = "default";
18-
const PER_FILE_DEBUG_MODE = "perFile";
18+
const DEVELOPER_MODE = "developer";
1919
const DISABLE_DEBUG_MODE = "ignore";
20-
const MFTF_DEBUG_MODES = [self::DEFAULT_DEBUG_MODE, self::PER_FILE_DEBUG_MODE, self::DISABLE_DEBUG_MODE];
20+
const MFTF_DEBUG_MODES = [self::DEFAULT_DEBUG_MODE, self::DEVELOPER_MODE, self::DISABLE_DEBUG_MODE];
2121

2222
/**
2323
* Determines whether the user has specified a force option for generation
@@ -87,7 +87,7 @@ private function __construct(
8787
* @param boolean $forceGenerate
8888
* @param string $phase
8989
* @param boolean $verboseEnabled
90-
* @param string $debug
90+
* @param string $debug
9191
* @return void
9292
*/
9393
public static function create($forceGenerate, $phase, $verboseEnabled, $debug)

src/Magento/FunctionalTestingFramework/Config/Reader/Filesystem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ protected function readFiles($fileList)
157157
} else {
158158
$configMerger->merge($content);
159159
}
160-
if (MftfApplicationConfig::getConfig()->getDebugMode() == MftfApplicationConfig::PER_FILE_DEBUG_MODE) {
160+
if (MftfApplicationConfig::getConfig()->getDebugMode() === MftfApplicationConfig::DEVELOPER_MODE) {
161161
$this->validateSchema($configMerger, $fileList->getFilename());
162162
}
163163
} catch (\Magento\FunctionalTestingFramework\Config\Dom\ValidationException $e) {
@@ -231,7 +231,7 @@ protected function validateSchema($configMerger, $filename = null)
231231
if ($this->validationState->isValidationRequired()) {
232232
$errors = [];
233233
if ($configMerger && !$configMerger->validate($this->schemaFile, $errors)) {
234-
foreach ($errors as $error){
234+
foreach ($errors as $error) {
235235
$error = str_replace("\n", "", $error);
236236
LoggingUtil::getInstance()->getLogger(Filesystem::class)->criticalFailure(
237237
"Schema validation error. ",

src/Magento/FunctionalTestingFramework/Config/Reader/MftfFilesystem.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public function readFiles($fileList)
4141
} else {
4242
$configMerger->merge($content, $fileList->getFilename(), $exceptionCollector);
4343
}
44-
// run per file validation with generate:tests -d
44+
// run per file validation with generate:tests -d
4545
if (!in_array($debugMode, MftfApplicationConfig::MFTF_DEBUG_MODES) ||
46-
$debugMode == MftfApplicationConfig::PER_FILE_DEBUG_MODE) {
46+
$debugMode === MftfApplicationConfig::DEVELOPER_MODE) {
4747
$this->validateSchema($configMerger, $fileList->getFilename());
4848
}
4949
} catch (\Magento\FunctionalTestingFramework\Config\Dom\ValidationException $e) {
@@ -55,9 +55,9 @@ public function readFiles($fileList)
5555
$this->validateSchema($configMerger, $fileList->getFilename());
5656
}
5757

58-
// run validation on merged file with generate:tests
59-
if ($debugMode == MftfApplicationConfig::DEFAULT_DEBUG_MODE) {
60-
$this->validateSchema($configMerger);
58+
//run validation on merged file with generate:tests
59+
if ($debugMode === MftfApplicationConfig::DEFAULT_DEBUG_MODE) {
60+
$this->validateSchema($configMerger, $debugMode);
6161
}
6262

6363
$output = [];

src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class GenerateTestsCommand extends BaseGenerateCommand
2929
protected function configure()
3030
{
3131
$this->setName('generate:tests')
32-
->setDescription('This command runs validation and generates all test files and suites based on xml declarations')
32+
->setDescription('Run validation and generate all test files and suites based on xml declarations')
3333
->addArgument(
3434
'name',
3535
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
@@ -39,7 +39,7 @@ protected function configure()
3939
"force",
4040
'f',
4141
InputOption::VALUE_NONE,
42-
'force generation of tests regardless of Magento Instance Configuration'
42+
'Force generation of tests regardless of Magento Instance Configuration'
4343
)->addOption(
4444
'time',
4545
'i',
@@ -55,7 +55,8 @@ protected function configure()
5555
'debug',
5656
'd',
5757
InputOption::VALUE_OPTIONAL,
58-
'run per file validation while running tests. Use option \'ignore\' to skip debugging',
58+
'Run per file validation while running tests. Use option \'ignore\' to skip debugging --
59+
added for backward compatibility, will be removed in the next MAJOR release',
5960
'default'
6061
);
6162

@@ -79,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7980
$json = $input->getOption('tests');
8081
$force = $input->getOption('force');
8182
$time = $input->getOption('time') * 60 * 1000; // convert from minutes to milliseconds
82-
$debug = $input->getOption('debug')?? MftfApplicationConfig::PER_FILE_DEBUG_MODE; // set to per file if no option specified
83+
$debug = $input->getOption('debug')?? MftfApplicationConfig::DEVELOPER_MODE;
8384
$remove = $input->getOption('remove');
8485
$verbose = $output->isVerbose();
8586

@@ -125,7 +126,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
125126
* @param string $json
126127
* @param array $tests
127128
* @param boolean $force
128-
* @param string $debug
129+
* @param string $debug
129130
* @param boolean $verbose
130131
* @return array
131132
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException

0 commit comments

Comments
 (0)