Skip to content

Commit a6a50c8

Browse files
committed
MQE-1962: Remove support of deprecated locations for tests
1 parent 55ac3b8 commit a6a50c8

File tree

3 files changed

+60
-26
lines changed

3 files changed

+60
-26
lines changed

docs/mftf-tests-packaging.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<style>
2+
.mftf-dl {
3+
margin-bottom: 2.5em;
4+
}
5+
dl dt{
6+
font-weight:400;
7+
}
8+
</style>
9+
10+
# MFTF functional test modules and packaging
11+
12+
## MFTF predefined test module paths
13+
The Magento Functional Testing Framework can run tests from predefined paths and custom paths. The predefined paths are:
14+
```
15+
app/code/<Vendor>/<Module>/Test/Mftf
16+
dev/tests/acceptance/tests/functional/<Vendor>/<TestModule>
17+
vendor/<Vendor>/<Module>/Test/Mftf
18+
vendor/<Vendor>/<TestModule>
19+
```
20+
21+
To support future service isolation, Test module in `dev/tests/acceptance/tests/functional/<Vendor>/<TestModule>` and
22+
`vendor/<Vendor>/<TestModule>` must define the module type as `magento2-functional-test-module` in a `composer.json` file.
23+
No `composer.json` file is required for tests in `app/code/<Vendor>/<Module>/Test/Mftf` and `vendor/<Vendor>/<Module>/Test/Mftf`
24+
as they are part of the Magento modules.
25+
26+
Test module for a specific Magento module can only be in one of the path.
27+
28+
## Test module composer.json format
29+
30+
Test module `composer.json` file should use type `magento2-functional-test-module`.
31+
32+
Test module `composer.json` file should define Magento module dependencies in suggests block.
33+
MFTF will recognize the dependency if the suggest message of a module specifies `type` using `magento2-module` and `name`
34+
using module name registered with Magento.
35+
36+
Here is an example `composer.json` file for the test module `dev/tests/acceptance/tests/functional/Magento/ConfigurableProductCatalogSearch`:
37+
38+
```json
39+
{
40+
"name": "magento/module-configurable-product-catalog-search-functional-test",
41+
"description": "MFTF test module for Magento_ConfigurableProduct and Magento_CatalogSearch",
42+
"type": "magento2-functional-test-module",
43+
"config": {
44+
"sort-packages": true
45+
},
46+
"require": {
47+
"magento/magento2-functional-testing-framework": ">=2.5"
48+
},
49+
"suggest": {
50+
"magento/module-configurable-product": "type: magento2-module, name: Magento_ConfigurableProduct, version: *",
51+
"magento/module-catalog-search": "type: magento2-module, name: Magento_CatalogSearch, version: *"
52+
},
53+
"license": [
54+
"OSL-3.0",
55+
"AFL-3.0"
56+
]
57+
}
58+
```

docs/mftf-tests.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ dl dt{
99

1010
# MFTF functional test reference
1111

12-
The Magento Functional Testing Framework runs tests on every Module within Magento. These files are stored within each Module folder in the Magento repo.
13-
This page lists all those tests so that developers can have a good sense of what is covered.
12+
This page lists all existing tests so that developers can have a good sense of what is covered.
1413

1514
{% include mftf/functional_data.md %}
1615

src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ class ModuleResolver
5454
. 'tests'
5555
. DIRECTORY_SEPARATOR
5656
. 'functional';
57-
const DEPRECATED_DEV_TESTS = DIRECTORY_SEPARATOR
58-
. self:: DEV_TESTS
59-
. DIRECTORY_SEPARATOR
60-
. "Magento"
61-
. DIRECTORY_SEPARATOR
62-
. "FunctionalTest";
6357

6458
/**
6559
* Enabled modules.
@@ -327,8 +321,7 @@ private function aggregateTestModulePaths()
327321
$codePathsToPattern = [
328322
$modulePath => '',
329323
$magentoBaseCodePath . $vendorCodePath => self::TEST_MFTF_PATTERN,
330-
$magentoBaseCodePath . $appCodePath => self::TEST_MFTF_PATTERN,
331-
$magentoBaseCodePath . self::DEPRECATED_DEV_TESTS => ''
324+
$magentoBaseCodePath . $appCodePath => self::TEST_MFTF_PATTERN
332325
];
333326

334327
foreach ($codePathsToPattern as $codePath => $pattern) {
@@ -374,22 +367,6 @@ private function globRelevantPaths($testPath, $pattern)
374367
}
375368
}
376369

377-
/* TODO uncomment this to show deprecation warning when we ready to fully deliver test packaging feature
378-
if (strpos($testPath, self::DEPRECATED_DEV_TESTS) !== false && !empty($modulePaths)) {
379-
$deprecatedPath = ltrim(self::DEPRECATED_DEV_TESTS, DIRECTORY_SEPARATOR);
380-
$suggestedPath = self::DEV_TESTS . DIRECTORY_SEPARATOR . 'Magento';
381-
$message = "DEPRECATION: Found MFTF test modules in the deprecated path: $deprecatedPath."
382-
. " Move these test modules to $suggestedPath.";
383-
384-
if (MftfApplicationConfig::getConfig()->verboseEnabled()) {
385-
LoggingUtil::getInstance()->getLogger(ModuleResolver::class)->warning($message);
386-
}
387-
// Suppress print during unit testing
388-
if (MftfApplicationConfig::getConfig()->getPhase() !== MftfApplicationConfig::UNIT_TEST_PHASE) {
389-
print ("\n$message\n\n");
390-
}
391-
}
392-
*/
393370
return $modulePaths;
394371
}
395372

0 commit comments

Comments
 (0)