Skip to content

MFTF 2.4.1 - Merge develop to master #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 81 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
6c9c34d
Updating contribution guides for docs.
dobooth Apr 1, 2019
ef7a76e
Merge branch 'develop' into db_contributions
dobooth Apr 1, 2019
06d2e91
Merge branch 'develop' of github.com:magento/magento2-functional-test…
dobooth Apr 2, 2019
0c43a9e
Update .github/CONTRIBUTING.md
dshevtsov Apr 2, 2019
5569b0a
Update .github/DOCUMENTATION_TEMPLATE.md
dshevtsov Apr 2, 2019
2cc5666
Update .github/DOCUMENTATION_TEMPLATE.md
dshevtsov Apr 2, 2019
2290e2e
Fixes per review.
dobooth Apr 2, 2019
a6786ee
Update .github/DOCUMENTATION_TEMPLATE.md
dshevtsov Apr 2, 2019
a0faa1d
Update .github/DOCUMENTATION_TEMPLATE.md
dshevtsov Apr 2, 2019
5f27f40
Update .github/DOCUMENTATION_TEMPLATE.md
dshevtsov Apr 2, 2019
acc9238
Update .github/DOCUMENTATION_TEMPLATE.md
dshevtsov Apr 2, 2019
978d945
Update .github/DOCUMENTATION_TEMPLATE.md
dshevtsov Apr 2, 2019
6182ec9
Update .github/DOCUMENTATION_TEMPLATE.md
dshevtsov Apr 2, 2019
447ed0f
More review fixes.
dobooth Apr 2, 2019
2099d30
Fixed link.
dobooth Apr 2, 2019
9c68e7d
Fixed header
dobooth Apr 2, 2019
539a562
Merge branch 'master' into db_contributions
dobooth Apr 5, 2019
9501614
Fixes per review.
dobooth Apr 5, 2019
d0fd11b
Cleaned up header
dobooth Apr 15, 2019
b9d2459
Merge branch 'develop' into db_contributions
dobooth Apr 15, 2019
0b23734
Grammar fix.
dobooth Apr 16, 2019
70e59a5
Fixed grammar.
dobooth Apr 22, 2019
2eef763
Indenting so markdown syntax shows.
dobooth Apr 29, 2019
42bc8d1
Indenting so markdown syntax shows.
dobooth Apr 29, 2019
51d66eb
Linked to Basic Template.
dobooth Apr 29, 2019
53f6bae
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 7, 2019
b3e5912
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 7, 2019
a4f9ff8
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 8, 2019
e76354c
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 8, 2019
6480ccc
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 8, 2019
f1f2381
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 8, 2019
baad750
Add version table and update instructions.
dobooth May 9, 2019
3a7c942
Removed dupe upgrade instructions.
dobooth May 10, 2019
741e81d
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 14, 2019
5e96fb4
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 14, 2019
f5d0040
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 15, 2019
7ad4084
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 15, 2019
3f67629
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 15, 2019
5039664
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 15, 2019
ea5b72e
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 16, 2019
29d5435
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 16, 2019
592aba9
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 16, 2019
3f39f44
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 16, 2019
489ca5e
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 17, 2019
27bd6b3
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 17, 2019
eb83bc5
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 20, 2019
81414c8
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 21, 2019
a3f25bd
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 21, 2019
958e9c3
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 21, 2019
016332c
Updated title.
dobooth May 21, 2019
41f8039
Update docs/versioning.md
dobooth May 21, 2019
4929a59
Update docs/versioning.md
dobooth May 21, 2019
645eb05
Update docs/versioning.md
dobooth May 21, 2019
ca23a75
Merge branch 'develop' into db_version_table
dobooth May 21, 2019
8c7c139
Update .github/DOCUMENTATION_TEMPLATE.md
dobooth May 21, 2019
f03a564
Update .github/DOCUMENTATION_TEMPLATE.md
dobooth May 21, 2019
eaa1d0e
Merge branch 'develop' into db_contributions
dobooth May 21, 2019
7e2b4d8
Merge branches 'MQE-1541' and 'develop' of https://github.com/magento…
soumyau May 21, 2019
2c9b92c
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 21, 2019
2e92c25
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 21, 2019
291bad3
Merge pull request #325 from magento-devdocs/db_contributions
tomreece May 21, 2019
40d16e6
Merge branch 'develop' into db_version_table
tomreece May 21, 2019
5e90be5
Grammar and formatting.
dobooth May 21, 2019
f72eee0
Merge branch 'develop' into MQE-1541
dobooth May 21, 2019
9150d91
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 21, 2019
a779d9b
Merge pull request #350 from magento-devdocs/db_version_table
tomreece May 22, 2019
5f0e625
Merge branch 'develop' into MQE-1541
KevinBKozan May 22, 2019
e11a5d0
MQE-1541: Documentation for debug changes (#353)
soumyau May 23, 2019
5c1536d
MQE-1570: Add release to CHANGELOG.MD
KevinBKozan May 24, 2019
0e18c22
Merge pull request #355 from magento/MQE-1570
KevinBKozan May 24, 2019
c83f2e9
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 29, 2019
e445902
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 29, 2019
f3f53c5
MQE-1541: Add option to generate:tests for XSD validation on 'merged …
soumyau May 29, 2019
14a433a
Merge pull request #357 from magento/MQE-1541
okolesnyk May 30, 2019
9422f83
MQE-1570: Add release to CHANGELOG.MD
soumyau Jun 6, 2019
d972c20
MQE-1570: Add release to CHANGELOG.MD
soumyau Jun 6, 2019
ac6eef8
Merge branch 'develop' into MQE-1570
KevinBKozan Jun 7, 2019
b95b38f
Merge pull request #361 from magento/MQE-1570
soumyau Jun 7, 2019
588298e
MQE-1569: [2.4.1 - Release] Checklist
soumyau Jun 7, 2019
48dd236
MQE-1569: [2.4.1 - Release] Checklist
soumyau Jun 7, 2019
41caa75
Merge pull request #363 from magento/MQE-1569
soumyau Jun 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ All contributors are required to submit a click-through form to agree to the ter

- Unit/integration test coverage
- Proposed documentation update.
For the documentation contribution guidelines, see [DevDocs Contributing][devdocs].
For the documentation contribution guidelines, see [DOCUMENTATION_TEMPLATE][].
7. For large features or changes, [open an issue][issue] to discuss first.
This may prevent duplicate or unnecessary effort, and it may gain you some additional contributors.
8. To report a bug, [open an issue][issue], and follow [guidelines about bugfix issues][issue reporting].
Expand Down Expand Up @@ -160,7 +160,7 @@ Label| Description
[create issue]: https://help.github.com/articles/creating-an-issue/
[create pr]: https://help.github.com/articles/creating-a-pull-request/
[Definition of Done]: https://devdocs.magento.com/guides/v2.2/contributor-guide/contributing_dod.html
[devdocs]: https://github.com/magento/devdocs/blob/master/.github/CONTRIBUTING.html
[DOCUMENTATION_TEMPLATE]: https://github.com/magento/devdocs/blob/master/.github/DOCUMENTATION_TEMPLATE.md
[existing issues]: https://github.com/magento/magento2-functional-testing-framework/issues?q=is%3Aopen+is%3Aissue
[existing PRs]: https://github.com/magento/magento2-functional-testing-framework/pulls?q=is%3Aopen+is%3Apr
[GitHub documentation]: https://help.github.com/articles/syncing-a-fork
Expand All @@ -171,4 +171,4 @@ Label| Description
[Magento Contributor Agreement]: http://www.magento.com/legaldocuments/mca
[MFTF repository]: https://github.com/magento/magento2-functional-testing-framework
[open new issue]: https://github.com/magento/magento2-functional-testing-framework/issues/new
[Travis CI]: https://travis-ci.com/magento/magento2-functional-testing-framework/pull_requests
[Travis CI]: https://travis-ci.com/magento/magento2-functional-testing-framework/pull_requests
26 changes: 26 additions & 0 deletions .github/DOCUMENTATION_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# How to contribute to MFTF docs

We welcome contributions to the MFTF documentation, which is kept within the `docs/` folder in this repository.
This page describes the submitting process and serves as a template for a properly written content.
The contribution workflow is the same as submitting code.

1. Create a branch from the `develop` branch in the [MFTF repository][].
1. Make edits/additions/deletions as needed. Read the [Basic Template][] for tips on how to write with Markdown.
1. Submit your pull request to the `develop` branch.

Once submitted, a member of the documentation team will review and merge it.
We will inform you if it needs any additional processing.

The documentation in this repository is used as the source for the [MFTF documentation][].
Any changes to the table of contents will need to be made through a separate pull request in the regular [Magento Developer documentation repository][].

Read more about how to [Contribute to Magento Devdocs][].

<!-- For readability, we abstract the link URLS to the bottom of the page. The extra set of square brackets denotes it is a link, rather than plain brackets. >

<!-- Link Definitions -->
[Magento Developer documentation repository]: https://github.com/magento/devdocs/blob/master/_data/toc/mftf.yml
[MFTF repository]: https://github.com/magento/magento2-functional-testing-framework
[Contribute to Magento Devdocs]: https://github.com/magento/devdocs/blob/master/.github/CONTRIBUTING.md
[MFTF documentation]: https://devdocs.magento.com/mftf/docs/introduction.html
[Basic Template]: https://devdocs.magento.com/guides/v2.3/contributor-guide/templates/basic_template.html
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Magento Functional Testing Framework Changelog
================================================

2.4.1
-----
* Traceability
* XSD Schema validation is now enabled by default in `generate:tests`
* `generate:tests --debug` option has been updated to include different debug levels
* See DevDocs for details

### Fixes
* Fixed an issue where `skipReadiness` attribute would cause false XSD Schema validation errors.

2.4.0
-----
### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion bin/mftf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ try {
try {
$application = new Symfony\Component\Console\Application();
$application->setName('Magento Functional Testing Framework CLI');
$application->setVersion('2.4.0');
$application->setVersion('2.4.1');
/** @var \Magento\FunctionalTestingFramework\Console\CommandListInterface $commandList */
$commandList = new \Magento\FunctionalTestingFramework\Console\CommandList;
foreach ($commandList->getCommands() as $command) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/magento2-functional-testing-framework",
"description": "Magento2 Functional Testing Framework",
"type": "library",
"version": "2.4.0",
"version": "2.4.1",
"license": "AGPL-3.0",
"keywords": ["magento", "automation", "functional", "testing"],
"config": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev/tests/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
true,
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::UNIT_TEST_PHASE,
true,
false
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::LEVEL_NONE
);

// Load needed framework env params
Expand Down
4 changes: 1 addition & 3 deletions dev/tests/verification/Resources/BasicFunctionalTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ class BasicFunctionalTestCest
{
$I->comment("");
$I->comment("");
$I->skipReadinessCheck(true);
$I->comment("skipReadiness");
$I->skipReadinessCheck(false);
$I->comment("seeComment");
$someVarDefinition = $I->grabValueFrom();
$I->acceptPopup();
$I->amOnPage("/test/url");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@
<see selector=".selector" userInput="{{sameStepKeyAsArg}}" stepKey="arg1" />
</actionGroup>

<actionGroup name="actionGroupWithSkipReadinessActions">
<comment userInput="ActionGroupSkipReadiness" stepKey="skip" skipReadiness="true"/>
</actionGroup>

<actionGroup name="actionGroupWithSectionAndData">
<arguments>
<argument name="content" type="string"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</after>
<comment stepKey="basicCommentWithNoData" userInput="{{emptyData.noData}}"/>
<comment stepKey="basicCommentWithDefinitelyNoData" userInput="{{emptyData.definitelyNoData}}"/>
<comment stepKey="ReadinessCheckSkipped" userInput="skipReadiness" skipReadiness="true"/>
<comment stepKey="basicCommentWithData" userInput="seeComment"/>
<grabValueFrom stepKey="someVarDefinition"/>
<acceptPopup stepKey="acceptPopupKey1"/>
<amOnPage stepKey="amOnPageKey1" url="/test/url"/>
Expand Down
11 changes: 0 additions & 11 deletions dev/tests/verification/Tests/ActionGroupGenerationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,6 @@ public function testActionGroupWithArgContainingStepKey()
$this->generateAndCompareTest('ActionGroupContainsStepKeyInArgText');
}

/**
* Test an action group with an arg containing stepKey text
*
* @throws \Exception
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
*/
public function testActionGroupWithSkipReadiness()
{
$this->generateAndCompareTest('ActionGroupSkipReadiness');
}

/**
* Test an action group with an arg containing stepKey text
*
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Tests/SchemaValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SchemaValidationTest extends MftfTestCase
*/
public function testInvalidTestSchema()
{
AspectMock::double(MftfApplicationConfig::class, ['debugEnabled' => true]);
AspectMock::double(MftfApplicationConfig::class, ['getDebugLevel' => MftfApplicationConfig::LEVEL_DEVELOPER]);
$testFile = ['testFile.xml' => "<tests><test name='testName'><annotations>a</annotations></test></tests>"];
$expectedError = TESTS_MODULE_PATH .
DIRECTORY_SEPARATOR .
Expand Down
14 changes: 12 additions & 2 deletions docs/commands/mftf.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ vendor/bin/mftf build:project --MAGENTO_BASE_URL=http://magento.local/ --MAGENTO

#### Description

Generate PHP code from the tests defined in XML files.
Perform XML schema validation and generate PHP code from the tests defined in XML files.
The path is set in the `TESTS_MODULE_PATH` [configuration] parameter.

#### Usage
Expand All @@ -122,9 +122,19 @@ vendor/bin/mftf generate:tests [option] [<test name>] [<test name>] [--remove]
| `--force` | Forces test generation, regardless of the module merge order defined in the Magento instance. Example: `generate:tests --force`. |
| `-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`|
| `--tests` | Defines the test configuration as a JSON string.|
| `--debug` | Returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. This parameter takes extra processing time. Use it after test generation has failed once. |
| `--debug=[<developer> or <none>]`| Set debug level to `default` when the option is not specified, to `developer` with `--debug developer` or `--debug`, to `none` with `--debug none` | |
| `-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.|

#### Debugging levels

You can run `generate:tests` with any of the following debug levels. XML schema validation errors will be logged as CRITICAL failures.

| Debug level | Description |
| ---| --- |
|`default` `[generate:tests]` | Perform XML schema validation on merged files. Does not indicate the file name where the error is encountered. Use `developer` level for enhanced debugging. |
|`developer` `[generate:tests --debug or generate:tests --debug developer]` | Returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. Note: This option takes extra processing time. Use it after test generation has failed once. |
|`none` `[generate:tests --debug none]`| Skip debugging during test generation. Added for backward compatibility, it will be removed with the next MAJOR release.|

#### Examples of the JSON configuration

The configuration to generate a single test with no suites:
Expand Down
12 changes: 11 additions & 1 deletion docs/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ X.Y.Z
| | +-- Backward Compatible changes (Patch release - bug fixes, small additions)
| +---- Backward Compatible changes (Minor release - small new features, bug fixes)
+------ Backward Incompatible changes (Major release - new features and/or major changes)

```

For example:
Expand All @@ -56,3 +55,14 @@ It MAY include patch level changes. Patch version MUST be reset to 0 when minor
Major version **X** MUST be incremented for a release that introduces backward incompatible changes.
A major release can also include minor and patch level changes.
You must reset the patch and minor version to 0 when you change the major version.

## Magento 2 compatibility

This table lists the version of the MFTF that was released with a particular version of Magento.

|Magento version| MFTF version|
|---|---|
| 2.3.1 | 2.3.13 |
| 2.3.0 | 2.3.9 |
| 2.2.8 | 2.3.13 |
| 2.2.7 | 2.3.8 |
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ class MftfApplicationConfig
const UNIT_TEST_PHASE = "testing";
const MFTF_PHASES = [self::GENERATION_PHASE, self::EXECUTION_PHASE, self::UNIT_TEST_PHASE];

/**
* Mftf debug levels
*/
const LEVEL_DEFAULT = "default";
const LEVEL_DEVELOPER = "developer";
const LEVEL_NONE = "none";
const MFTF_DEBUG_LEVEL = [self::LEVEL_DEFAULT, self::LEVEL_DEVELOPER, self::LEVEL_NONE];

/**
* Determines whether the user has specified a force option for generation
*
Expand All @@ -36,11 +44,11 @@ class MftfApplicationConfig
private $verboseEnabled;

/**
* Determines whether the user would like to execute mftf in a verbose run.
* String which identifies the current debug level of mftf execution
*
* @var boolean
* @var string
*/
private $debugEnabled;
private $debugLevel;

/**
* MftfApplicationConfig Singelton Instance
Expand All @@ -55,14 +63,14 @@ class MftfApplicationConfig
* @param boolean $forceGenerate
* @param string $phase
* @param boolean $verboseEnabled
* @param boolean $debugEnabled
* @param string $debugLevel
* @throws TestFrameworkException
*/
private function __construct(
$forceGenerate = false,
$phase = self::EXECUTION_PHASE,
$verboseEnabled = null,
$debugEnabled = null
$debugLevel = self::LEVEL_NONE
) {
$this->forceGenerate = $forceGenerate;

Expand All @@ -72,7 +80,15 @@ private function __construct(

$this->phase = $phase;
$this->verboseEnabled = $verboseEnabled;
$this->debugEnabled = $debugEnabled;
switch ($debugLevel) {
case self::LEVEL_DEVELOPER:
case self::LEVEL_DEFAULT:
case self::LEVEL_NONE:
$this->debugLevel = $debugLevel;
break;
default:
$this->debugLevel = self::LEVEL_DEVELOPER;
}
}

/**
Expand All @@ -82,14 +98,14 @@ private function __construct(
* @param boolean $forceGenerate
* @param string $phase
* @param boolean $verboseEnabled
* @param boolean $debugEnabled
* @param string $debugLevel
* @return void
*/
public static function create($forceGenerate, $phase, $verboseEnabled, $debugEnabled)
public static function create($forceGenerate, $phase, $verboseEnabled, $debugLevel)
{
if (self::$MFTF_APPLICATION_CONTEXT == null) {
self::$MFTF_APPLICATION_CONTEXT =
new MftfApplicationConfig($forceGenerate, $phase, $verboseEnabled, $debugEnabled);
new MftfApplicationConfig($forceGenerate, $phase, $verboseEnabled, $debugLevel);
}
}

Expand Down Expand Up @@ -132,14 +148,13 @@ public function verboseEnabled()
}

/**
* Returns a boolean indicating whether the user has indicated a debug run, which will lengthy validation
* with some extra error messaging to be run
* Returns a string which indicates the debug level of mftf execution.
*
* @return boolean
* @return string
*/
public function debugEnabled()
public function getDebugLevel()
{
return $this->debugEnabled ?? getenv('MFTF_DEBUG');
return $this->debugLevel ?? getenv('MFTF_DEBUG');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected function readFiles($fileList)
} else {
$configMerger->merge($content);
}
if (MftfApplicationConfig::getConfig()->debugEnabled()) {
if (MftfApplicationConfig::getConfig()->getDebugLevel() === MftfApplicationConfig::LEVEL_DEVELOPER) {
$this->validateSchema($configMerger, $fileList->getFilename());
}
} catch (\Magento\FunctionalTestingFramework\Config\Dom\ValidationException $e) {
Expand Down Expand Up @@ -231,8 +231,14 @@ protected function validateSchema($configMerger, $filename = null)
if ($this->validationState->isValidationRequired()) {
$errors = [];
if ($configMerger && !$configMerger->validate($this->schemaFile, $errors)) {
$message = $filename ? $filename . PHP_EOL . "Invalid Document \n" : PHP_EOL . "Invalid Document \n";
throw new \Exception($message . implode("\n", $errors));
foreach ($errors as $error) {
$error = str_replace(PHP_EOL, "", $error);
LoggingUtil::getInstance()->getLogger(Filesystem::class)->criticalFailure(
"Schema validation error ",
($filename ? [ "file"=> $filename, "error" => $error]: ["error" => $error])
);
}
throw new \Exception("Schema validation errors found in xml file(s)" . $filename);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function readFiles($fileList)
$exceptionCollector = new ExceptionCollector();
/** @var \Magento\FunctionalTestingFramework\Test\Config\Dom $configMerger */
$configMerger = null;
$debugLevel = MftfApplicationConfig::getConfig()->getDebugLevel();
foreach ($fileList as $key => $content) {
//check if file is empty and continue to next if it is
if (!parent::verifyFileEmpty($content, $fileList->getFilename())) {
Expand All @@ -40,16 +41,19 @@ public function readFiles($fileList)
} else {
$configMerger->merge($content, $fileList->getFilename(), $exceptionCollector);
}
if (MftfApplicationConfig::getConfig()->debugEnabled()) {
// run per file validation with generate:tests -d
if ($debugLevel == MftfApplicationConfig::LEVEL_DEVELOPER) {
$this->validateSchema($configMerger, $fileList->getFilename());
}
} catch (\Magento\FunctionalTestingFramework\Config\Dom\ValidationException $e) {
throw new \Exception("Invalid XML in file " . $key . ":\n" . $e->getMessage());
}
}
$exceptionCollector->throwException();
if ($fileList->valid()) {
$this->validateSchema($configMerger, $fileList->getFilename());

//run validation on merged file with generate:tests
if ($debugLevel == MftfApplicationConfig::LEVEL_DEFAULT) {
$this->validateSchema($configMerger);
}

$output = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$force,
MftfApplicationConfig::GENERATION_PHASE,
false,
false
MftfApplicationConfig::LEVEL_NONE
);

$allActionGroups = ActionGroupObjectHandler::getInstance()->getAllObjects();
Expand Down
Loading