From a6a50c8a1669705f42af84f3345cb6a72d2081aa Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Mon, 10 Feb 2020 14:33:22 -0600 Subject: [PATCH 1/5] MQE-1962: Remove support of deprecated locations for tests --- docs/mftf-tests-packaging.md | 58 +++++++++++++++++++ docs/mftf-tests.md | 3 +- .../Util/ModuleResolver.php | 25 +------- 3 files changed, 60 insertions(+), 26 deletions(-) create mode 100644 docs/mftf-tests-packaging.md diff --git a/docs/mftf-tests-packaging.md b/docs/mftf-tests-packaging.md new file mode 100644 index 000000000..07e13718b --- /dev/null +++ b/docs/mftf-tests-packaging.md @@ -0,0 +1,58 @@ + + +# MFTF functional test modules and packaging + +## MFTF predefined test module paths +The Magento Functional Testing Framework can run tests from predefined paths and custom paths. The predefined paths are: +``` +app/code///Test/Mftf +dev/tests/acceptance/tests/functional// +vendor///Test/Mftf +vendor// +``` + +To support future service isolation, Test module in `dev/tests/acceptance/tests/functional//` and +`vendor//` must define the module type as `magento2-functional-test-module` in a `composer.json` file. +No `composer.json` file is required for tests in `app/code///Test/Mftf` and `vendor///Test/Mftf` +as they are part of the Magento modules. + +Test module for a specific Magento module can only be in one of the path. + +## Test module composer.json format + +Test module `composer.json` file should use type `magento2-functional-test-module`. + +Test module `composer.json` file should define Magento module dependencies in suggests block. +MFTF will recognize the dependency if the suggest message of a module specifies `type` using `magento2-module` and `name` +using module name registered with Magento. + +Here is an example `composer.json` file for the test module `dev/tests/acceptance/tests/functional/Magento/ConfigurableProductCatalogSearch`: + +```json +{ + "name": "magento/module-configurable-product-catalog-search-functional-test", + "description": "MFTF test module for Magento_ConfigurableProduct and Magento_CatalogSearch", + "type": "magento2-functional-test-module", + "config": { + "sort-packages": true + }, + "require": { + "magento/magento2-functional-testing-framework": ">=2.5" + }, + "suggest": { + "magento/module-configurable-product": "type: magento2-module, name: Magento_ConfigurableProduct, version: *", + "magento/module-catalog-search": "type: magento2-module, name: Magento_CatalogSearch, version: *" + }, + "license": [ + "OSL-3.0", + "AFL-3.0" + ] +} +``` \ No newline at end of file diff --git a/docs/mftf-tests.md b/docs/mftf-tests.md index cb1941053..8554396bf 100644 --- a/docs/mftf-tests.md +++ b/docs/mftf-tests.md @@ -9,8 +9,7 @@ dl dt{ # MFTF functional test reference -The Magento Functional Testing Framework runs tests on every Module within Magento. These files are stored within each Module folder in the Magento repo. -This page lists all those tests so that developers can have a good sense of what is covered. +This page lists all existing tests so that developers can have a good sense of what is covered. {% include mftf/functional_data.md %} diff --git a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php index aa9a08ddb..d5e90841d 100644 --- a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php +++ b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php @@ -54,12 +54,6 @@ class ModuleResolver . 'tests' . DIRECTORY_SEPARATOR . 'functional'; - const DEPRECATED_DEV_TESTS = DIRECTORY_SEPARATOR - . self:: DEV_TESTS - . DIRECTORY_SEPARATOR - . "Magento" - . DIRECTORY_SEPARATOR - . "FunctionalTest"; /** * Enabled modules. @@ -327,8 +321,7 @@ private function aggregateTestModulePaths() $codePathsToPattern = [ $modulePath => '', $magentoBaseCodePath . $vendorCodePath => self::TEST_MFTF_PATTERN, - $magentoBaseCodePath . $appCodePath => self::TEST_MFTF_PATTERN, - $magentoBaseCodePath . self::DEPRECATED_DEV_TESTS => '' + $magentoBaseCodePath . $appCodePath => self::TEST_MFTF_PATTERN ]; foreach ($codePathsToPattern as $codePath => $pattern) { @@ -374,22 +367,6 @@ private function globRelevantPaths($testPath, $pattern) } } - /* TODO uncomment this to show deprecation warning when we ready to fully deliver test packaging feature - if (strpos($testPath, self::DEPRECATED_DEV_TESTS) !== false && !empty($modulePaths)) { - $deprecatedPath = ltrim(self::DEPRECATED_DEV_TESTS, DIRECTORY_SEPARATOR); - $suggestedPath = self::DEV_TESTS . DIRECTORY_SEPARATOR . 'Magento'; - $message = "DEPRECATION: Found MFTF test modules in the deprecated path: $deprecatedPath." - . " Move these test modules to $suggestedPath."; - - if (MftfApplicationConfig::getConfig()->verboseEnabled()) { - LoggingUtil::getInstance()->getLogger(ModuleResolver::class)->warning($message); - } - // Suppress print during unit testing - if (MftfApplicationConfig::getConfig()->getPhase() !== MftfApplicationConfig::UNIT_TEST_PHASE) { - print ("\n$message\n\n"); - } - } - */ return $modulePaths; } From 196498dd499d4ec260fc4aeca66decca1f55eed2 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Mon, 10 Feb 2020 14:55:23 -0600 Subject: [PATCH 2/5] MQE-1962: Remove support of deprecated locations for tests --- .../Util/ModuleResolverTest.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php index 07e1ee7fa..ad0b1769d 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php @@ -146,20 +146,6 @@ function ($arg) { 'Test' . DIRECTORY_SEPARATOR .'Mftf' ] ); - $mockResolver->verifyInvoked( - 'globRelevantPaths', - [ - $magentoBaseCodePath - . DIRECTORY_SEPARATOR . "dev" - . DIRECTORY_SEPARATOR . "tests" - . DIRECTORY_SEPARATOR . "acceptance" - . DIRECTORY_SEPARATOR . "tests" - . DIRECTORY_SEPARATOR . "functional" - . DIRECTORY_SEPARATOR . "Magento" - . DIRECTORY_SEPARATOR . "FunctionalTest" - , '' - ] - ); } /** From b13a8b700dfcd3b31fe46f083028ead675891bae Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Wed, 12 Feb 2020 16:07:25 -0600 Subject: [PATCH 3/5] MQE-1962: Remove support of deprecated locations for tests --- src/Magento/FunctionalTestingFramework/_bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/_bootstrap.php b/src/Magento/FunctionalTestingFramework/_bootstrap.php index a5ce1f931..214f6a34b 100644 --- a/src/Magento/FunctionalTestingFramework/_bootstrap.php +++ b/src/Magento/FunctionalTestingFramework/_bootstrap.php @@ -66,7 +66,7 @@ // define TEST_PATH and TEST_MODULE_PATH defined('TESTS_BP') || define('TESTS_BP', realpath(MAGENTO_BP . DIRECTORY_SEPARATOR . 'dev/tests/acceptance')); -$RELATIVE_TESTS_MODULE_PATH = '/tests/functional/Magento/FunctionalTest'; +$RELATIVE_TESTS_MODULE_PATH = '/tests/functional/Magento'; defined('TESTS_MODULE_PATH') || define( 'TESTS_MODULE_PATH', realpath(TESTS_BP . $RELATIVE_TESTS_MODULE_PATH) From 39ecbd0e1c1fcf27b158375a04723b51deb0072d Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Fri, 21 Feb 2020 11:14:57 -0600 Subject: [PATCH 4/5] MQE-1962: Remove support of deprecated locations for tests --- docs/mftf-tests-packaging.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/mftf-tests-packaging.md b/docs/mftf-tests-packaging.md index 07e13718b..8a37b8013 100644 --- a/docs/mftf-tests-packaging.md +++ b/docs/mftf-tests-packaging.md @@ -19,11 +19,11 @@ vendor// ``` To support future service isolation, Test module in `dev/tests/acceptance/tests/functional//` and -`vendor//` must define the module type as `magento2-functional-test-module` in a `composer.json` file. +`vendor//` must define the module type as `magento2-functional-test-module` in its `composer.json` file. No `composer.json` file is required for tests in `app/code///Test/Mftf` and `vendor///Test/Mftf` as they are part of the Magento modules. -Test module for a specific Magento module can only be in one of the path. +Test module for a specific Magento module can only be in one of the paths. ## Test module composer.json format From 65bb8c0718ae9a0658007fdc7ac1afb462a27401 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Mon, 2 Mar 2020 13:35:49 -0600 Subject: [PATCH 5/5] MQE-1962: Bump MFTF version to 3.0.0 --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 0ff50a2e8..5fc595478 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/magento2-functional-testing-framework", "description": "Magento2 Functional Testing Framework", "type": "library", - "version": "2.6.3", + "version": "3.0.0", "license": "AGPL-3.0", "keywords": ["magento", "automation", "functional", "testing"], "config": { diff --git a/composer.lock b/composer.lock index 6f370593b..cd692f7e6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "83e4e17679bff5fdd472c246dca8ac48", + "content-hash": "21ca9c7fef683977c7a1bbb0591c54b0", "packages": [ { "name": "allure-framework/allure-codeception",