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", 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" - , '' - ] - ); } /** diff --git a/docs/mftf-tests-packaging.md b/docs/mftf-tests-packaging.md new file mode 100644 index 000000000..8a37b8013 --- /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 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 paths. + +## 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/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; } 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)