Skip to content

Commit 65919fe

Browse files
authored
Merge pull request #612 from magento/MQE-1581
MQE-1581: Remove NONE debug level for next MFTF major release
2 parents 5ecf5be + 053c6e5 commit 65919fe

File tree

8 files changed

+21
-20
lines changed

8 files changed

+21
-20
lines changed

dev/tests/_bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
true,
3636
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::UNIT_TEST_PHASE,
3737
true,
38-
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::LEVEL_NONE,
38+
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::LEVEL_DEFAULT,
3939
false
4040
);
4141

docs/commands/mftf.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ vendor/bin/mftf generate:tests [option] [<test name>] [<test name>] [--remove]
164164
| `-i,--time` | Set time in minutes to determine the group size when `--config=parallel` is used. The __default value__ is `10`. Example: `generate:tests --config=parallel --time=15`|
165165
| `--tests` | Defines the test configuration as a JSON string.|
166166
| `--allow-skipped` | Allows MFTF to generate and run tests marked with `<skip>.`|
167-
| `--debug or --debug=[<none>]`| Performs schema validations on XML files. <br/> DEFAULT: `generate:tests` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. <br/> DEVELOPER: `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. This option takes extra processing time. Use it after test generation has failed once.<br/>NONE: `--debug=none` skips debugging during test generation. Added for backward compatibility, it will be removed in the next MAJOR release.<br/>|
167+
| `--debug` | Performs schema validations on XML files. <br/> DEFAULT: `generate:tests` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. <br/> DEVELOPER: `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. This option takes extra processing time. Use it after test generation has failed once.<br/>|
168168
| `-r,--remove`| Removes the existing generated suites and tests cleaning up the `_generated` directory before the actual run. For example, `generate:tests SampleTest --remove` cleans up the entire `_generated` directory and generates `SampleTest` only.|
169169

170170
#### Examples of the JSON configuration
@@ -337,7 +337,7 @@ vendor/bin/mftf run:group [--skip-generate|--remove] [--] <group1> [<group2>]
337337
| --------------------- | --------------------------------------------------------------------------------------------------------- |
338338
| `-k, --skip-generate` | Skips generating from the source XML. Instead, the command executes previously-generated groups of tests. |
339339
| `-r, --remove` | Removes previously generated suites and tests before the actual generation and run. |
340-
| `--debug or --debug=[<none>]`| Performs schema validations on XML files. `run:group` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred). `--debug=none` skips debugging during test run. Added for backward compatibility, it will be removed in the next MAJOR release.|
340+
| `--debug` | Performs schema validations on XML files. `run:group` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred).|
341341

342342
#### Examples
343343

@@ -369,7 +369,7 @@ vendor/bin/mftf run:test [--skip-generate|--remove] [--] <name1> [<name2>]
369369
|-----------------------|-----------------------------------------------------------------------------------------------------------|
370370
| `-k, --skip-generate` | Skips generating from the source XML. Instead, the command executes previously-generated groups of tests. |
371371
| `-r, --remove` | Remove previously generated suites and tests. |
372-
| `--debug or --debug=[<none>]`| Performs schema validations on XML files. `run:test` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred). `--debug=none` skips debugging during test run. Added for backward compatibility, it will be removed in the next MAJOR release.
372+
| `--debug` | Performs schema validations on XML files. `run:test` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred).|
373373

374374
#### Examples
375375

@@ -419,7 +419,7 @@ vendor/bin/mftf run:failed
419419

420420
| Option | Description |
421421
|-----------------------|-----------------------------------------------------------------------------------------------------------|
422-
| `--debug or --debug=[<none>]`| Performs schema validations on XML files. `run:failed` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred). Use it after test run has failed once. `--debug=none` skips debugging during test run. Added for backward compatibility, it will be removed in the next MAJOR release.|
422+
| `--debug` | Performs schema validations on XML files. `run:failed` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred). Use it after test run has failed once.|
423423

424424
#### Examples
425425

src/Magento/FunctionalTestingFramework/Config/MftfApplicationConfig.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ class MftfApplicationConfig
2323
*/
2424
const LEVEL_DEFAULT = "default";
2525
const LEVEL_DEVELOPER = "developer";
26-
const LEVEL_NONE = "none";
27-
const MFTF_DEBUG_LEVEL = [self::LEVEL_DEFAULT, self::LEVEL_DEVELOPER, self::LEVEL_NONE];
26+
const MFTF_DEBUG_LEVEL = [self::LEVEL_DEFAULT, self::LEVEL_DEVELOPER];
2827

2928
/**
3029
* Contains object with test filters.
@@ -89,7 +88,7 @@ private function __construct(
8988
$forceGenerate = false,
9089
$phase = self::EXECUTION_PHASE,
9190
$verboseEnabled = null,
92-
$debugLevel = self::LEVEL_NONE,
91+
$debugLevel = self::LEVEL_DEFAULT,
9392
$allowSkipped = false,
9493
$filters = []
9594
) {
@@ -101,14 +100,17 @@ private function __construct(
101100

102101
$this->phase = $phase;
103102
$this->verboseEnabled = $verboseEnabled;
104-
switch ($debugLevel) {
103+
if (isset($debugLevel) && !in_array(strtolower($debugLevel), self::MFTF_DEBUG_LEVEL)) {
104+
throw new TestFrameworkException("{$debugLevel} is not a debug level. Use 'DEFAULT' or 'DEVELOPER'");
105+
}
106+
switch (strtolower($debugLevel)) {
105107
case self::LEVEL_DEVELOPER:
106108
case self::LEVEL_DEFAULT:
107-
case self::LEVEL_NONE:
108109
$this->debugLevel = $debugLevel;
109110
break;
110-
default:
111+
case null:
111112
$this->debugLevel = self::LEVEL_DEVELOPER;
113+
break;
112114
}
113115
$this->allowSkipped = $allowSkipped;
114116
$this->filterList = new FilterList($filters);
@@ -131,7 +133,7 @@ public static function create(
131133
$forceGenerate = false,
132134
$phase = self::EXECUTION_PHASE,
133135
$verboseEnabled = null,
134-
$debugLevel = self::LEVEL_NONE,
136+
$debugLevel = self::LEVEL_DEFAULT,
135137
$allowSkipped = false,
136138
$filters = []
137139
) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ protected function readFiles($fileList)
146146
{
147147
/** @var \Magento\FunctionalTestingFramework\Config\Dom $configMerger */
148148
$configMerger = null;
149+
$debugLevel = MftfApplicationConfig::getConfig()->getDebugLevel();
149150
foreach ($fileList as $key => $content) {
150151
//check if file is empty and continue to next if it is
151152
if (!$this->verifyFileEmpty($content, $fileList->getFilename())) {
@@ -157,7 +158,7 @@ protected function readFiles($fileList)
157158
} else {
158159
$configMerger->merge($content);
159160
}
160-
if (MftfApplicationConfig::getConfig()->getDebugLevel() === MftfApplicationConfig::LEVEL_DEVELOPER) {
161+
if (strcasecmp($debugLevel, MftfApplicationConfig::LEVEL_DEVELOPER) == 0) {
161162
$this->validateSchema($configMerger, $fileList->getFilename());
162163
}
163164
} catch (\Magento\FunctionalTestingFramework\Config\Dom\ValidationException $e) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function readFiles($fileList)
4242
$configMerger->merge($content, $fileList->getFilename(), $exceptionCollector);
4343
}
4444
// run per file validation with generate:tests -d
45-
if ($debugLevel === MftfApplicationConfig::LEVEL_DEVELOPER) {
45+
if (strcasecmp($debugLevel, MftfApplicationConfig::LEVEL_DEVELOPER) == 0) {
4646
$this->validateSchema($configMerger, $fileList->getFilename());
4747
}
4848
} catch (\Magento\FunctionalTestingFramework\Config\Dom\ValidationException $e) {
@@ -52,7 +52,7 @@ public function readFiles($fileList)
5252
$exceptionCollector->throwException();
5353

5454
//run validation on merged file with generate:tests
55-
if ($debugLevel === MftfApplicationConfig::LEVEL_DEFAULT) {
55+
if (strcasecmp($debugLevel, MftfApplicationConfig::LEVEL_DEFAULT) == 0) {
5656
$this->validateSchema($configMerger);
5757
}
5858

src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ protected function configure()
5858
'debug',
5959
'd',
6060
InputOption::VALUE_OPTIONAL,
61-
'Run extra validation when generating and running tests. Use option \'none\' to turn off debugging --
62-
added for backward compatibility, will be removed in the next MAJOR release',
61+
'Run extra validation when generating and running tests.',
6362
MftfApplicationConfig::LEVEL_DEFAULT
6463
);
6564
}

src/Magento/FunctionalTestingFramework/Console/GenerateDocsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6767
$force,
6868
MftfApplicationConfig::GENERATION_PHASE,
6969
false,
70-
MftfApplicationConfig::LEVEL_NONE,
70+
MftfApplicationConfig::LEVEL_DEFAULT,
7171
true
7272
);
7373

src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
123123

124124
// Remove previous GENERATED_DIR if --remove option is used
125125
if ($remove) {
126-
$this->removeGeneratedDirectory($output, $verbose ||
127-
($debug !== MftfApplicationConfig::LEVEL_NONE));
126+
$this->removeGeneratedDirectory($output, $verbose);
128127
}
129128

130129
try {

0 commit comments

Comments
 (0)