Skip to content

Commit 3a18c6b

Browse files
authored
Merge pull request #595 from magento/MQE-1962
MQE-1962: Remove support of deprecated locations for tests
2 parents f1820ff + 65bb8c0 commit 3a18c6b

File tree

6 files changed

+62
-41
lines changed

6 files changed

+62
-41
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento2-functional-testing-framework",
33
"description": "Magento2 Functional Testing Framework",
44
"type": "library",
5-
"version": "2.6.3",
5+
"version": "3.0.0",
66
"license": "AGPL-3.0",
77
"keywords": ["magento", "automation", "functional", "testing"],
88
"config": {

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,6 @@ function ($arg) {
146146
'Test' . DIRECTORY_SEPARATOR .'Mftf'
147147
]
148148
);
149-
$mockResolver->verifyInvoked(
150-
'globRelevantPaths',
151-
[
152-
$magentoBaseCodePath
153-
. DIRECTORY_SEPARATOR . "dev"
154-
. DIRECTORY_SEPARATOR . "tests"
155-
. DIRECTORY_SEPARATOR . "acceptance"
156-
. DIRECTORY_SEPARATOR . "tests"
157-
. DIRECTORY_SEPARATOR . "functional"
158-
. DIRECTORY_SEPARATOR . "Magento"
159-
. DIRECTORY_SEPARATOR . "FunctionalTest"
160-
, ''
161-
]
162-
);
163149
}
164150

165151
/**

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 its `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 paths.
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+
```

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

src/Magento/FunctionalTestingFramework/_bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
// define TEST_PATH and TEST_MODULE_PATH
6767
defined('TESTS_BP') || define('TESTS_BP', realpath(MAGENTO_BP . DIRECTORY_SEPARATOR . 'dev/tests/acceptance'));
6868

69-
$RELATIVE_TESTS_MODULE_PATH = '/tests/functional/Magento/FunctionalTest';
69+
$RELATIVE_TESTS_MODULE_PATH = '/tests/functional/Magento';
7070
defined('TESTS_MODULE_PATH') || define(
7171
'TESTS_MODULE_PATH',
7272
realpath(TESTS_BP . $RELATIVE_TESTS_MODULE_PATH)

0 commit comments

Comments
 (0)