From 9a87b57e34edaa9922b40f3c7e50ea5501242584 Mon Sep 17 00:00:00 2001 From: Gabriel Galvao da Gama Date: Tue, 29 Sep 2020 14:07:44 +0100 Subject: [PATCH 01/15] Added static and semver tests docs --- src/_data/main-nav.yml | 2 - src/_data/toc/testing.yml | 14 ++++- .../v2.3/test/semver/semver_test_execution.md | 38 +++++++++++++ .../v2.3/test/static/static_test_execution.md | 54 +++++++++++++++++++ .../v2.3/test/unit/unit_test_execution.md | 52 +++++++++++++----- .../v2.4/test/semver/semver_test_execution.md | 38 +++++++++++++ .../v2.4/test/static/static_test_execution.md | 1 + 7 files changed, 184 insertions(+), 15 deletions(-) create mode 100644 src/guides/v2.3/test/semver/semver_test_execution.md create mode 100644 src/guides/v2.3/test/static/static_test_execution.md create mode 100644 src/guides/v2.4/test/semver/semver_test_execution.md create mode 120000 src/guides/v2.4/test/static/static_test_execution.md diff --git a/src/_data/main-nav.yml b/src/_data/main-nav.yml index 77eb8529878..64971609dd1 100644 --- a/src/_data/main-nav.yml +++ b/src/_data/main-nav.yml @@ -179,8 +179,6 @@ - label: Web API Functional Testing url: /get-started/web-api-functional-testing.html -- - - label: Functional Areas children: diff --git a/src/_data/toc/testing.yml b/src/_data/toc/testing.yml index 4a6de164324..2270ce5de15 100644 --- a/src/_data/toc/testing.yml +++ b/src/_data/toc/testing.yml @@ -62,4 +62,16 @@ pages: children: - label: '@dataProvider' - url: /test/unit/annotations/data-provider.html \ No newline at end of file + url: /test/unit/annotations/data-provider.html + + - label: Static Testing + children: + + - label: Running Static Tests + url: /test/static/static_test_execution.html + + - label: Semantic Version Checker + children: + + - label: Running SVC tool + url: /test/semver/semver_test_execution.html \ No newline at end of file diff --git a/src/guides/v2.3/test/semver/semver_test_execution.md b/src/guides/v2.3/test/semver/semver_test_execution.md new file mode 100644 index 00000000000..36d54bb2ff3 --- /dev/null +++ b/src/guides/v2.3/test/semver/semver_test_execution.md @@ -0,0 +1,38 @@ +--- +group: testing +title: Running Semantic Version Checker +functional_areas: + - Testing + - test +--- + +Executing the Magento 2 Semantic Version Checker is a simple process but, it requires an external tool to be done. + +### Running Semantic Version Checker on local changes + +To run the Semantic Version Checker on local changes, you need to: + +**Step 1.** Clone the `magento-semver` tool to your local machine: + +```bash +git clone git@github.com:magento/magento-semver.git +``` + +**Step 2.** Navigate to the cloned repository and run composer install to install the project dependencies: + +```bash +cd magento-semver && composer install +``` + +**Step 3.** In order to run the Semantic Version Checker we need to have one folder with the feature changes and another folder with mainline code (without changes), +so you may need to clone the Magento repository to a separate folder to perform the comparison. + +**Step 4.** Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: + +```bash +.bin/svc compare ../magento2-mainline ../magento2 +``` + +The first parameter is the mainline code (2.3-develop branch) without any changes, and the second parameter is the path to the Magento with your feature changes. + +As a result of this command you will get the results of the Semantic Version Checker tool. diff --git a/src/guides/v2.3/test/static/static_test_execution.md b/src/guides/v2.3/test/static/static_test_execution.md new file mode 100644 index 00000000000..769da14d451 --- /dev/null +++ b/src/guides/v2.3/test/static/static_test_execution.md @@ -0,0 +1,54 @@ +--- +group: testing +title: Running Static Tests +functional_areas: + - Testing + - test +--- + +Executing the Magento 2 static tests is straight forward. They can be executed in different ways. + +### Running static tests on all files + +To run static tests on all files, navigate to the Magento base directory and execute the following command + +```bash +./bin/magento dev:test:run static +``` + +### Running PHP static tests on a subset of files + +To run the static tests on a subset of files, you will have to create a new testsuite for phpunit: + +**Step 1.** Navigate to the Magento base directory and then to `dev/tests/static/testsuite/Magento/Test` + +**Step 2.** Create a copy of the `Php` folder on the same directory and name it `Local` + +**Step 3.** Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and edit the `common.txt` file + +**Step 4.** Replace the content on this file with the folder of the files that you want to test, for example: + +```text +# Format: or simply +app/code/Magento/CatalogSearch/Model/Search +``` + +**Step 5.** Add a new testsuite to the `dev/tests/static/phpunit.xml.dist` file inside the `` node: +: + +```xml + + ... + + testsuite/Magento/Test/Local/LiveCodeTest.php + + +``` + +**Step 6.** Navigate to the Magento base directory and run this command: + +```bash +./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist +``` + +As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. \ No newline at end of file diff --git a/src/guides/v2.3/test/unit/unit_test_execution.md b/src/guides/v2.3/test/unit/unit_test_execution.md index e1020ca7e57..769da14d451 100644 --- a/src/guides/v2.3/test/unit/unit_test_execution.md +++ b/src/guides/v2.3/test/unit/unit_test_execution.md @@ -1,26 +1,54 @@ --- group: testing -title: Running Unit Tests -contributor_name: Vinai Kopp -contributor_link: http://vinaikopp.com/ +title: Running Static Tests functional_areas: - Testing - test --- -Executing the Magento 2 unit tests is straight forward. -They can be executed in several different ways. +Executing the Magento 2 static tests is straight forward. They can be executed in different ways. -### Command Line Interface (CLI) +### Running static tests on all files -This option is useful for running the tests during Continuous Integration or on remote servers, or if no IDE with PHPUnit support is available. It only requires a minimum amount of setup. +To run static tests on all files, navigate to the Magento base directory and execute the following command -Please refer to [Running Unit Tests in the CLI]({{ page.baseurl }}/test/unit/unit_test_execution_cli.html) for further information. +```bash +./bin/magento dev:test:run static +``` -### PhpStorm IDE +### Running PHP static tests on a subset of files -Running the tests inside an IDE like PhpStorm IDE is convenient for developers, since it allows for easier navigation in the code and debugging. +To run the static tests on a subset of files, you will have to create a new testsuite for phpunit: -Other than convenience there is no benefit over running the tests on the console. +**Step 1.** Navigate to the Magento base directory and then to `dev/tests/static/testsuite/Magento/Test` -Please refer to [Running Unit Tests in PhpStorm]({{ page.baseurl }}/test/unit/unit_test_execution_phpstorm.html) for further information. +**Step 2.** Create a copy of the `Php` folder on the same directory and name it `Local` + +**Step 3.** Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and edit the `common.txt` file + +**Step 4.** Replace the content on this file with the folder of the files that you want to test, for example: + +```text +# Format: or simply +app/code/Magento/CatalogSearch/Model/Search +``` + +**Step 5.** Add a new testsuite to the `dev/tests/static/phpunit.xml.dist` file inside the `` node: +: + +```xml + + ... + + testsuite/Magento/Test/Local/LiveCodeTest.php + + +``` + +**Step 6.** Navigate to the Magento base directory and run this command: + +```bash +./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist +``` + +As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. \ No newline at end of file diff --git a/src/guides/v2.4/test/semver/semver_test_execution.md b/src/guides/v2.4/test/semver/semver_test_execution.md new file mode 100644 index 00000000000..966ce4dbbd8 --- /dev/null +++ b/src/guides/v2.4/test/semver/semver_test_execution.md @@ -0,0 +1,38 @@ +--- +group: testing +title: Running Semantic Version Checker +functional_areas: + - Testing + - test +--- + +Executing the Magento 2 Semantic Version Checker is a simple process but, it requires an external tool to be done. + +### Running Semantic Version Checker on local changes + +To run the Semantic Version Checker on local changes, you need to: + +**Step 1.** Clone the `magento-semver` tool to your local machine: + +```bash +git clone git@github.com:magento/magento-semver.git +``` + +**Step 2.** Navigate to the cloned repository and run composer install to install the project dependencies: + +```bash +cd magento-semver && composer install +``` + +**Step 3.** In order to run the Semantic Version Checker we need to have one folder with the feature changes and another folder with mainline code (without changes), +so you may need to clone the Magento repository to a separate folder to perform the comparison. + +**Step 4.** Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: + +```bash +.bin/svc compare ../magento2-mainline ../magento2 +``` + +The first parameter is the mainline code (2.4-develop branch) without any changes, and the second parameter is the path to the Magento with your feature changes. + +As a result of this command you will get the results of the Semantic Version Checker tool. diff --git a/src/guides/v2.4/test/static/static_test_execution.md b/src/guides/v2.4/test/static/static_test_execution.md new file mode 120000 index 00000000000..07ab8a06733 --- /dev/null +++ b/src/guides/v2.4/test/static/static_test_execution.md @@ -0,0 +1 @@ +../../../v2.3/test/unit/unit_test_execution.md \ No newline at end of file From ffaa20b07cf7ce22591da5e94867347c1a6ed6ea Mon Sep 17 00:00:00 2001 From: Gabriel Galvao da Gama Date: Tue, 29 Sep 2020 14:09:37 +0100 Subject: [PATCH 02/15] Renamed folder to svc --- src/_data/toc/testing.yml | 2 +- src/guides/v2.3/test/{semver => svc}/semver_test_execution.md | 0 src/guides/v2.4/test/{semver => svc}/semver_test_execution.md | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename src/guides/v2.3/test/{semver => svc}/semver_test_execution.md (100%) rename src/guides/v2.4/test/{semver => svc}/semver_test_execution.md (100%) diff --git a/src/_data/toc/testing.yml b/src/_data/toc/testing.yml index 2270ce5de15..0017cd21baf 100644 --- a/src/_data/toc/testing.yml +++ b/src/_data/toc/testing.yml @@ -74,4 +74,4 @@ pages: children: - label: Running SVC tool - url: /test/semver/semver_test_execution.html \ No newline at end of file + url: /test/svc/semver_test_execution.html \ No newline at end of file diff --git a/src/guides/v2.3/test/semver/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md similarity index 100% rename from src/guides/v2.3/test/semver/semver_test_execution.md rename to src/guides/v2.3/test/svc/semver_test_execution.md diff --git a/src/guides/v2.4/test/semver/semver_test_execution.md b/src/guides/v2.4/test/svc/semver_test_execution.md similarity index 100% rename from src/guides/v2.4/test/semver/semver_test_execution.md rename to src/guides/v2.4/test/svc/semver_test_execution.md From e3a05e311a79c9faf7ebd885ee65f6b5483d2323 Mon Sep 17 00:00:00 2001 From: Gabriel Galvao da Gama Date: Tue, 29 Sep 2020 14:12:54 +0100 Subject: [PATCH 03/15] Reverted undesired changes --- .../v2.3/test/unit/unit_test_execution.md | 52 +++++-------------- 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/src/guides/v2.3/test/unit/unit_test_execution.md b/src/guides/v2.3/test/unit/unit_test_execution.md index 769da14d451..e1020ca7e57 100644 --- a/src/guides/v2.3/test/unit/unit_test_execution.md +++ b/src/guides/v2.3/test/unit/unit_test_execution.md @@ -1,54 +1,26 @@ --- group: testing -title: Running Static Tests +title: Running Unit Tests +contributor_name: Vinai Kopp +contributor_link: http://vinaikopp.com/ functional_areas: - Testing - test --- -Executing the Magento 2 static tests is straight forward. They can be executed in different ways. +Executing the Magento 2 unit tests is straight forward. +They can be executed in several different ways. -### Running static tests on all files +### Command Line Interface (CLI) -To run static tests on all files, navigate to the Magento base directory and execute the following command +This option is useful for running the tests during Continuous Integration or on remote servers, or if no IDE with PHPUnit support is available. It only requires a minimum amount of setup. -```bash -./bin/magento dev:test:run static -``` +Please refer to [Running Unit Tests in the CLI]({{ page.baseurl }}/test/unit/unit_test_execution_cli.html) for further information. -### Running PHP static tests on a subset of files +### PhpStorm IDE -To run the static tests on a subset of files, you will have to create a new testsuite for phpunit: +Running the tests inside an IDE like PhpStorm IDE is convenient for developers, since it allows for easier navigation in the code and debugging. -**Step 1.** Navigate to the Magento base directory and then to `dev/tests/static/testsuite/Magento/Test` +Other than convenience there is no benefit over running the tests on the console. -**Step 2.** Create a copy of the `Php` folder on the same directory and name it `Local` - -**Step 3.** Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and edit the `common.txt` file - -**Step 4.** Replace the content on this file with the folder of the files that you want to test, for example: - -```text -# Format: or simply -app/code/Magento/CatalogSearch/Model/Search -``` - -**Step 5.** Add a new testsuite to the `dev/tests/static/phpunit.xml.dist` file inside the `` node: -: - -```xml - - ... - - testsuite/Magento/Test/Local/LiveCodeTest.php - - -``` - -**Step 6.** Navigate to the Magento base directory and run this command: - -```bash -./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist -``` - -As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. \ No newline at end of file +Please refer to [Running Unit Tests in PhpStorm]({{ page.baseurl }}/test/unit/unit_test_execution_phpstorm.html) for further information. From a3179dc59534f8b6c5a5d878f5f313b9f4d79938 Mon Sep 17 00:00:00 2001 From: Gabriel Galvao da Gama Date: Tue, 29 Sep 2020 14:15:27 +0100 Subject: [PATCH 04/15] Fixed issue with link to unit file --- .../v2.4/test/static/static_test_execution.md | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) mode change 120000 => 100644 src/guides/v2.4/test/static/static_test_execution.md diff --git a/src/guides/v2.4/test/static/static_test_execution.md b/src/guides/v2.4/test/static/static_test_execution.md deleted file mode 120000 index 07ab8a06733..00000000000 --- a/src/guides/v2.4/test/static/static_test_execution.md +++ /dev/null @@ -1 +0,0 @@ -../../../v2.3/test/unit/unit_test_execution.md \ No newline at end of file diff --git a/src/guides/v2.4/test/static/static_test_execution.md b/src/guides/v2.4/test/static/static_test_execution.md new file mode 100644 index 00000000000..769da14d451 --- /dev/null +++ b/src/guides/v2.4/test/static/static_test_execution.md @@ -0,0 +1,54 @@ +--- +group: testing +title: Running Static Tests +functional_areas: + - Testing + - test +--- + +Executing the Magento 2 static tests is straight forward. They can be executed in different ways. + +### Running static tests on all files + +To run static tests on all files, navigate to the Magento base directory and execute the following command + +```bash +./bin/magento dev:test:run static +``` + +### Running PHP static tests on a subset of files + +To run the static tests on a subset of files, you will have to create a new testsuite for phpunit: + +**Step 1.** Navigate to the Magento base directory and then to `dev/tests/static/testsuite/Magento/Test` + +**Step 2.** Create a copy of the `Php` folder on the same directory and name it `Local` + +**Step 3.** Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and edit the `common.txt` file + +**Step 4.** Replace the content on this file with the folder of the files that you want to test, for example: + +```text +# Format: or simply +app/code/Magento/CatalogSearch/Model/Search +``` + +**Step 5.** Add a new testsuite to the `dev/tests/static/phpunit.xml.dist` file inside the `` node: +: + +```xml + + ... + + testsuite/Magento/Test/Local/LiveCodeTest.php + + +``` + +**Step 6.** Navigate to the Magento base directory and run this command: + +```bash +./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist +``` + +As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. \ No newline at end of file From df21a73303c5cca38c6db978b6fd5b53e2b2ff05 Mon Sep 17 00:00:00 2001 From: Gabriel Galvao da Gama Date: Tue, 29 Sep 2020 15:50:39 +0100 Subject: [PATCH 05/15] Updated changes to avoid change on .dist files --- src/guides/v2.3/test/static/static_test_execution.md | 6 ++++-- src/guides/v2.4/test/static/static_test_execution.md | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/guides/v2.3/test/static/static_test_execution.md b/src/guides/v2.3/test/static/static_test_execution.md index 769da14d451..612b773355c 100644 --- a/src/guides/v2.3/test/static/static_test_execution.md +++ b/src/guides/v2.3/test/static/static_test_execution.md @@ -33,7 +33,9 @@ To run the static tests on a subset of files, you will have to create a new test app/code/Magento/CatalogSearch/Model/Search ``` -**Step 5.** Add a new testsuite to the `dev/tests/static/phpunit.xml.dist` file inside the `` node: +**Step 5.** Create a copy of `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: + +**Step 6.** Add a new testsuite to the `dev/tests/static/phpunit.xml` file inside the `` node: : ```xml @@ -45,7 +47,7 @@ app/code/Magento/CatalogSearch/Model/Search ``` -**Step 6.** Navigate to the Magento base directory and run this command: +**Step 7.** Navigate to the Magento base directory and run this command: ```bash ./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist diff --git a/src/guides/v2.4/test/static/static_test_execution.md b/src/guides/v2.4/test/static/static_test_execution.md index 769da14d451..612b773355c 100644 --- a/src/guides/v2.4/test/static/static_test_execution.md +++ b/src/guides/v2.4/test/static/static_test_execution.md @@ -33,7 +33,9 @@ To run the static tests on a subset of files, you will have to create a new test app/code/Magento/CatalogSearch/Model/Search ``` -**Step 5.** Add a new testsuite to the `dev/tests/static/phpunit.xml.dist` file inside the `` node: +**Step 5.** Create a copy of `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: + +**Step 6.** Add a new testsuite to the `dev/tests/static/phpunit.xml` file inside the `` node: : ```xml @@ -45,7 +47,7 @@ app/code/Magento/CatalogSearch/Model/Search ``` -**Step 6.** Navigate to the Magento base directory and run this command: +**Step 7.** Navigate to the Magento base directory and run this command: ```bash ./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist From 3f948b359e284430878cc5ae7667fbf6ffdd730e Mon Sep 17 00:00:00 2001 From: Gabriel da Gama Date: Thu, 1 Oct 2020 10:10:15 +0100 Subject: [PATCH 06/15] Apply suggestions from code review Co-authored-by: Barny Shergold --- src/guides/v2.3/test/static/static_test_execution.md | 11 +++++------ src/guides/v2.3/test/svc/semver_test_execution.md | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/guides/v2.3/test/static/static_test_execution.md b/src/guides/v2.3/test/static/static_test_execution.md index 612b773355c..cc9bfd57b3c 100644 --- a/src/guides/v2.3/test/static/static_test_execution.md +++ b/src/guides/v2.3/test/static/static_test_execution.md @@ -6,11 +6,11 @@ functional_areas: - test --- -Executing the Magento 2 static tests is straight forward. They can be executed in different ways. +Executing the Magento 2 static tests is straightforward. They can be executed in several ways. ### Running static tests on all files -To run static tests on all files, navigate to the Magento base directory and execute the following command +To run static tests on all files, navigate to the Magento base directory and execute the following command: ```bash ./bin/magento dev:test:run static @@ -26,17 +26,16 @@ To run the static tests on a subset of files, you will have to create a new test **Step 3.** Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and edit the `common.txt` file -**Step 4.** Replace the content on this file with the folder of the files that you want to test, for example: +**Step 4.** Replace the contents of this file with the folder of the files that you want to test, for example: ```text # Format: or simply app/code/Magento/CatalogSearch/Model/Search ``` -**Step 5.** Create a copy of `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: +**Step 5.** Create a copy of the `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: **Step 6.** Add a new testsuite to the `dev/tests/static/phpunit.xml` file inside the `` node: -: ```xml @@ -53,4 +52,4 @@ app/code/Magento/CatalogSearch/Model/Search ./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist ``` -As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. \ No newline at end of file +As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md index 36d54bb2ff3..0f7a7efb8ca 100644 --- a/src/guides/v2.3/test/svc/semver_test_execution.md +++ b/src/guides/v2.3/test/svc/semver_test_execution.md @@ -6,7 +6,7 @@ functional_areas: - test --- -Executing the Magento 2 Semantic Version Checker is a simple process but, it requires an external tool to be done. +Executing the Magento 2 Semantic Version Checker is a simple process, but it requires an external tool to be used. ### Running Semantic Version Checker on local changes From f0d5e94f29f9fd491351d9d412cfc5f9e4d1e644 Mon Sep 17 00:00:00 2001 From: Gabriel Galvao da Gama Date: Thu, 1 Oct 2020 10:27:38 +0100 Subject: [PATCH 07/15] Replaced files with symlinks --- .../v2.3/test/static/static_test_execution.md | 56 +------------------ .../v2.3/test/svc/semver_test_execution.md | 39 +------------ .../v2.4/test/svc/semver_test_execution.md | 2 +- 3 files changed, 3 insertions(+), 94 deletions(-) mode change 100644 => 120000 src/guides/v2.3/test/static/static_test_execution.md mode change 100644 => 120000 src/guides/v2.3/test/svc/semver_test_execution.md diff --git a/src/guides/v2.3/test/static/static_test_execution.md b/src/guides/v2.3/test/static/static_test_execution.md deleted file mode 100644 index cc9bfd57b3c..00000000000 --- a/src/guides/v2.3/test/static/static_test_execution.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -group: testing -title: Running Static Tests -functional_areas: - - Testing - - test ---- - -Executing the Magento 2 static tests is straightforward. They can be executed in several ways. - -### Running static tests on all files - -To run static tests on all files, navigate to the Magento base directory and execute the following command: - -```bash -./bin/magento dev:test:run static -``` - -### Running PHP static tests on a subset of files - -To run the static tests on a subset of files, you will have to create a new testsuite for phpunit: - -**Step 1.** Navigate to the Magento base directory and then to `dev/tests/static/testsuite/Magento/Test` - -**Step 2.** Create a copy of the `Php` folder on the same directory and name it `Local` - -**Step 3.** Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and edit the `common.txt` file - -**Step 4.** Replace the contents of this file with the folder of the files that you want to test, for example: - -```text -# Format: or simply -app/code/Magento/CatalogSearch/Model/Search -``` - -**Step 5.** Create a copy of the `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: - -**Step 6.** Add a new testsuite to the `dev/tests/static/phpunit.xml` file inside the `` node: - -```xml - - ... - - testsuite/Magento/Test/Local/LiveCodeTest.php - - -``` - -**Step 7.** Navigate to the Magento base directory and run this command: - -```bash -./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist -``` - -As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. diff --git a/src/guides/v2.3/test/static/static_test_execution.md b/src/guides/v2.3/test/static/static_test_execution.md new file mode 120000 index 00000000000..c239f99778a --- /dev/null +++ b/src/guides/v2.3/test/static/static_test_execution.md @@ -0,0 +1 @@ +../../../v2.4/test/static/static_test_execution.md \ No newline at end of file diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md deleted file mode 100644 index 0f7a7efb8ca..00000000000 --- a/src/guides/v2.3/test/svc/semver_test_execution.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -group: testing -title: Running Semantic Version Checker -functional_areas: - - Testing - - test ---- - -Executing the Magento 2 Semantic Version Checker is a simple process, but it requires an external tool to be used. - -### Running Semantic Version Checker on local changes - -To run the Semantic Version Checker on local changes, you need to: - -**Step 1.** Clone the `magento-semver` tool to your local machine: - -```bash -git clone git@github.com:magento/magento-semver.git -``` - -**Step 2.** Navigate to the cloned repository and run composer install to install the project dependencies: - -```bash -cd magento-semver && composer install -``` - -**Step 3.** In order to run the Semantic Version Checker we need to have one folder with the feature changes and another folder with mainline code (without changes), -so you may need to clone the Magento repository to a separate folder to perform the comparison. - -**Step 4.** Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: - -```bash -.bin/svc compare ../magento2-mainline ../magento2 -``` - -The first parameter is the mainline code (2.3-develop branch) without any changes, and the second parameter is the path to the Magento with your feature changes. - -As a result of this command you will get the results of the Semantic Version Checker tool. diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md new file mode 120000 index 00000000000..22334818ed3 --- /dev/null +++ b/src/guides/v2.3/test/svc/semver_test_execution.md @@ -0,0 +1 @@ +../../../v2.4/test/svc/semver_test_execution.md \ No newline at end of file diff --git a/src/guides/v2.4/test/svc/semver_test_execution.md b/src/guides/v2.4/test/svc/semver_test_execution.md index 966ce4dbbd8..07b51f934f4 100644 --- a/src/guides/v2.4/test/svc/semver_test_execution.md +++ b/src/guides/v2.4/test/svc/semver_test_execution.md @@ -33,6 +33,6 @@ so you may need to clone the Magento repository to a separate folder to perform .bin/svc compare ../magento2-mainline ../magento2 ``` -The first parameter is the mainline code (2.4-develop branch) without any changes, and the second parameter is the path to the Magento with your feature changes. +The first parameter is the mainline code without any changes, and the second parameter is the path to the Magento with your feature changes. As a result of this command you will get the results of the Semantic Version Checker tool. From bae328ee380b7065bd0a44e75d5484a84970cc49 Mon Sep 17 00:00:00 2001 From: Gabriel Galvao da Gama Date: Thu, 1 Oct 2020 10:29:53 +0100 Subject: [PATCH 08/15] Fixed trailing spaces --- src/guides/v2.4/test/static/static_test_execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guides/v2.4/test/static/static_test_execution.md b/src/guides/v2.4/test/static/static_test_execution.md index 612b773355c..56e7e7dd31d 100644 --- a/src/guides/v2.4/test/static/static_test_execution.md +++ b/src/guides/v2.4/test/static/static_test_execution.md @@ -50,7 +50,7 @@ app/code/Magento/CatalogSearch/Model/Search **Step 7.** Navigate to the Magento base directory and run this command: ```bash -./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist +./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist ``` As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. \ No newline at end of file From 785ebfab49f25d1397b29e107e2f56d324698589 Mon Sep 17 00:00:00 2001 From: Gabriel Galvao da Gama Date: Thu, 1 Oct 2020 13:16:36 +0100 Subject: [PATCH 09/15] Implemented suggestions --- .../v2.3/test/static/static_test_execution.md | 56 +++++++++++++++++- .../v2.3/test/svc/semver_test_execution.md | 39 ++++++++++++- .../v2.4/test/static/static_test_execution.md | 57 +------------------ .../v2.4/test/svc/semver_test_execution.md | 39 +------------ 4 files changed, 95 insertions(+), 96 deletions(-) mode change 120000 => 100644 src/guides/v2.3/test/static/static_test_execution.md mode change 120000 => 100644 src/guides/v2.3/test/svc/semver_test_execution.md mode change 100644 => 120000 src/guides/v2.4/test/static/static_test_execution.md mode change 100644 => 120000 src/guides/v2.4/test/svc/semver_test_execution.md diff --git a/src/guides/v2.3/test/static/static_test_execution.md b/src/guides/v2.3/test/static/static_test_execution.md deleted file mode 120000 index c239f99778a..00000000000 --- a/src/guides/v2.3/test/static/static_test_execution.md +++ /dev/null @@ -1 +0,0 @@ -../../../v2.4/test/static/static_test_execution.md \ No newline at end of file diff --git a/src/guides/v2.3/test/static/static_test_execution.md b/src/guides/v2.3/test/static/static_test_execution.md new file mode 100644 index 00000000000..fcc5fc7b685 --- /dev/null +++ b/src/guides/v2.3/test/static/static_test_execution.md @@ -0,0 +1,55 @@ +--- +group: testing +title: Running Static Tests +functional_areas: + - Testing + - test +--- + +Executing the Magento 2 static tests is straightforward. They can be executed in several ways. + +### Running static tests on all files + +To run static tests on all files, navigate to the Magento base directory and execute the following command: + +```bash +./bin/magento dev:test:run static +``` + +### Running PHP static tests on a subset of files + +To run the static tests on a subset of files, you will have to create a new testsuite for phpunit: + +**Step 1.** Navigate to the Magento base directory and then to `dev/tests/static/testsuite/Magento/Test` + +**Step 2.** Create a copy of the `Php` folder on the same directory and name it `Local` + +**Step 3.** Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and edit the `common.txt` file + +**Step 4.** Replace the contents of this file with the folder of the files that you want to test, for example: + +```text +# Format: or simply +app/code/Magento/CatalogSearch/Model/Search +``` + +**Step 5.** Create a copy of the `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: + +**Step 6.** Add a new testsuite to the `dev/tests/static/phpunit.xml` file inside the `` node: + +```xml + + ... + + testsuite/Magento/Test/Local/LiveCodeTest.php + + +``` + +**Step 7.** Navigate to the Magento base directory and run this command: + +```bash +./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist +``` + +As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. \ No newline at end of file diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md deleted file mode 120000 index 22334818ed3..00000000000 --- a/src/guides/v2.3/test/svc/semver_test_execution.md +++ /dev/null @@ -1 +0,0 @@ -../../../v2.4/test/svc/semver_test_execution.md \ No newline at end of file diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md new file mode 100644 index 00000000000..81a065509b4 --- /dev/null +++ b/src/guides/v2.3/test/svc/semver_test_execution.md @@ -0,0 +1,38 @@ +--- +group: testing +title: Running Semantic Version Checker +functional_areas: + - Testing + - test +--- + +Executing the Magento 2 Semantic Version Checker is a simple process, but it requires an external tool to be used. + +### Running Semantic Version Checker on local changes + +To run the Semantic Version Checker on local changes, you need to: + +**Step 1.** Clone the `magento-semver` tool to your local machine: + +```bash +git clone git@github.com:magento/magento-semver.git +``` + +**Step 2.** Navigate to the cloned repository and run composer install to install the project dependencies: + +```bash +cd magento-semver && composer install +``` + +**Step 3.** In order to run the Semantic Version Checker we need to have one folder with the feature changes and another folder with mainline code (without changes), +so you may need to clone the Magento repository to a separate folder to perform the comparison. + +**Step 4.** Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: + +```bash +.bin/svc compare ../magento2-mainline ../magento2 +``` + +The first parameter is the mainline code without any changes, and the second parameter is the path to the Magento with your feature changes. + +As a result of this command you will get the results of the Semantic Version Checker tool. \ No newline at end of file diff --git a/src/guides/v2.4/test/static/static_test_execution.md b/src/guides/v2.4/test/static/static_test_execution.md deleted file mode 100644 index 56e7e7dd31d..00000000000 --- a/src/guides/v2.4/test/static/static_test_execution.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -group: testing -title: Running Static Tests -functional_areas: - - Testing - - test ---- - -Executing the Magento 2 static tests is straight forward. They can be executed in different ways. - -### Running static tests on all files - -To run static tests on all files, navigate to the Magento base directory and execute the following command - -```bash -./bin/magento dev:test:run static -``` - -### Running PHP static tests on a subset of files - -To run the static tests on a subset of files, you will have to create a new testsuite for phpunit: - -**Step 1.** Navigate to the Magento base directory and then to `dev/tests/static/testsuite/Magento/Test` - -**Step 2.** Create a copy of the `Php` folder on the same directory and name it `Local` - -**Step 3.** Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and edit the `common.txt` file - -**Step 4.** Replace the content on this file with the folder of the files that you want to test, for example: - -```text -# Format: or simply -app/code/Magento/CatalogSearch/Model/Search -``` - -**Step 5.** Create a copy of `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: - -**Step 6.** Add a new testsuite to the `dev/tests/static/phpunit.xml` file inside the `` node: -: - -```xml - - ... - - testsuite/Magento/Test/Local/LiveCodeTest.php - - -``` - -**Step 7.** Navigate to the Magento base directory and run this command: - -```bash -./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist -``` - -As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. \ No newline at end of file diff --git a/src/guides/v2.4/test/static/static_test_execution.md b/src/guides/v2.4/test/static/static_test_execution.md new file mode 120000 index 00000000000..f6fd01cfbb3 --- /dev/null +++ b/src/guides/v2.4/test/static/static_test_execution.md @@ -0,0 +1 @@ +../../../v2.3/test/static/static_test_execution.md \ No newline at end of file diff --git a/src/guides/v2.4/test/svc/semver_test_execution.md b/src/guides/v2.4/test/svc/semver_test_execution.md deleted file mode 100644 index 07b51f934f4..00000000000 --- a/src/guides/v2.4/test/svc/semver_test_execution.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -group: testing -title: Running Semantic Version Checker -functional_areas: - - Testing - - test ---- - -Executing the Magento 2 Semantic Version Checker is a simple process but, it requires an external tool to be done. - -### Running Semantic Version Checker on local changes - -To run the Semantic Version Checker on local changes, you need to: - -**Step 1.** Clone the `magento-semver` tool to your local machine: - -```bash -git clone git@github.com:magento/magento-semver.git -``` - -**Step 2.** Navigate to the cloned repository and run composer install to install the project dependencies: - -```bash -cd magento-semver && composer install -``` - -**Step 3.** In order to run the Semantic Version Checker we need to have one folder with the feature changes and another folder with mainline code (without changes), -so you may need to clone the Magento repository to a separate folder to perform the comparison. - -**Step 4.** Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: - -```bash -.bin/svc compare ../magento2-mainline ../magento2 -``` - -The first parameter is the mainline code without any changes, and the second parameter is the path to the Magento with your feature changes. - -As a result of this command you will get the results of the Semantic Version Checker tool. diff --git a/src/guides/v2.4/test/svc/semver_test_execution.md b/src/guides/v2.4/test/svc/semver_test_execution.md new file mode 120000 index 00000000000..b7ea12cf799 --- /dev/null +++ b/src/guides/v2.4/test/svc/semver_test_execution.md @@ -0,0 +1 @@ +../../../v2.3/test/svc/semver_test_execution.md \ No newline at end of file From 9af983096797ebaaf40a10220ee4e10514e2ca0d Mon Sep 17 00:00:00 2001 From: Donald Booth Date: Fri, 2 Oct 2020 13:17:52 -0500 Subject: [PATCH 10/15] Grammar and formatting --- .../v2.3/test/static/static_test_execution.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/guides/v2.3/test/static/static_test_execution.md b/src/guides/v2.3/test/static/static_test_execution.md index fcc5fc7b685..65b0f517445 100644 --- a/src/guides/v2.3/test/static/static_test_execution.md +++ b/src/guides/v2.3/test/static/static_test_execution.md @@ -6,50 +6,50 @@ functional_areas: - test --- -Executing the Magento 2 static tests is straightforward. They can be executed in several ways. +Executing Magento 2 static tests is straightforward. They can be executed in several ways. ### Running static tests on all files To run static tests on all files, navigate to the Magento base directory and execute the following command: ```bash -./bin/magento dev:test:run static +bin/magento dev:test:run static ``` ### Running PHP static tests on a subset of files -To run the static tests on a subset of files, you will have to create a new testsuite for phpunit: +To run the static tests on a subset of files, create a new testsuite for phpunit: -**Step 1.** Navigate to the Magento base directory and then to `dev/tests/static/testsuite/Magento/Test` +1. From the Magento base directory navigate to `dev/tests/static/testsuite/Magento/Test` -**Step 2.** Create a copy of the `Php` folder on the same directory and name it `Local` +1. Create a copy of the `Php` folder on the same directory and rename it to `Local` -**Step 3.** Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and edit the `common.txt` file +1. Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and open `common.txt` -**Step 4.** Replace the contents of this file with the folder of the files that you want to test, for example: +1. Replace the contents with the folder of the files that you want to test. For example: -```text -# Format: or simply -app/code/Magento/CatalogSearch/Model/Search -``` + ```text + # Format: or simply + app/code/Magento/CatalogSearch/Model/Search + ``` -**Step 5.** Create a copy of the `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: +1. Create a copy of the `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: -**Step 6.** Add a new testsuite to the `dev/tests/static/phpunit.xml` file inside the `` node: +1. Add a new testsuite to the `dev/tests/static/phpunit.xml` file inside the `` node: -```xml + ```xml ... testsuite/Magento/Test/Local/LiveCodeTest.php -``` + ``` -**Step 7.** Navigate to the Magento base directory and run this command: +1. Navigate to the Magento base directory and run: -```bash -./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist -``` + ```bash + ./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist + ``` -As a result of this process you will be able to run PHP static tests on a subset of files, it is also possible to run other types of static tests by following the same process but using other testsuites. \ No newline at end of file +As a result of this process, you can run PHP static tests on a subset of files. It is also possible to run other types of static tests by following the same process with other testsuites. From e106dc510ec030c3a8619fc9d6bdd1f321270fa2 Mon Sep 17 00:00:00 2001 From: Donald Booth Date: Fri, 2 Oct 2020 13:21:16 -0500 Subject: [PATCH 11/15] Grammar and formatting --- .../v2.3/test/svc/semver_test_execution.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md index 81a065509b4..3ad33e0896b 100644 --- a/src/guides/v2.3/test/svc/semver_test_execution.md +++ b/src/guides/v2.3/test/svc/semver_test_execution.md @@ -6,33 +6,32 @@ functional_areas: - test --- -Executing the Magento 2 Semantic Version Checker is a simple process, but it requires an external tool to be used. +Executing the Magento 2 Semantic Version Checker is a simple process, but it requires an external tool. ### Running Semantic Version Checker on local changes -To run the Semantic Version Checker on local changes, you need to: +To run the Semantic Version Checker on local changes: -**Step 1.** Clone the `magento-semver` tool to your local machine: +1. Clone the `magento-semver` tool to your local machine: -```bash -git clone git@github.com:magento/magento-semver.git -``` + ```bash + git clone git@github.com:magento/magento-semver.git + ``` -**Step 2.** Navigate to the cloned repository and run composer install to install the project dependencies: +1. Navigate to the cloned repository and run `composer install` to install the project dependencies: -```bash -cd magento-semver && composer install -``` + ```bash + cd magento-semver && composer install + ``` -**Step 3.** In order to run the Semantic Version Checker we need to have one folder with the feature changes and another folder with mainline code (without changes), +1. To run the Semantic Version Checker, we need one folder with the feature changes and another folder with mainline code (without changes), so you may need to clone the Magento repository to a separate folder to perform the comparison. -**Step 4.** Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: +1. Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: -```bash -.bin/svc compare ../magento2-mainline ../magento2 -``` + ```bash + bin/svc compare ../magento2-mainline ../magento2 + ``` -The first parameter is the mainline code without any changes, and the second parameter is the path to the Magento with your feature changes. - -As a result of this command you will get the results of the Semantic Version Checker tool. \ No newline at end of file +The first parameter is the mainline code without any changes, and the second parameter is the path to the folder with your changes. +This command you output the results of the Semantic Version Checker tool. From c5565a63522009af176975197a0106844a26d4b5 Mon Sep 17 00:00:00 2001 From: Gabriel da Gama Date: Wed, 7 Oct 2020 15:23:08 +0100 Subject: [PATCH 12/15] Update src/guides/v2.3/test/svc/semver_test_execution.md --- src/guides/v2.3/test/svc/semver_test_execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md index 3ad33e0896b..107100b3378 100644 --- a/src/guides/v2.3/test/svc/semver_test_execution.md +++ b/src/guides/v2.3/test/svc/semver_test_execution.md @@ -34,4 +34,4 @@ so you may need to clone the Magento repository to a separate folder to perform ``` The first parameter is the mainline code without any changes, and the second parameter is the path to the folder with your changes. -This command you output the results of the Semantic Version Checker tool. +The results of the Semantic Version Checker are outputted to the console. From 4b692ff0e0a9b686084d54f2e480032a4c0c3031 Mon Sep 17 00:00:00 2001 From: Donald Booth Date: Mon, 12 Oct 2020 09:22:28 -0500 Subject: [PATCH 13/15] Lint? --- src/guides/v2.3/test/svc/semver_test_execution.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md index 107100b3378..35e99977d85 100644 --- a/src/guides/v2.3/test/svc/semver_test_execution.md +++ b/src/guides/v2.3/test/svc/semver_test_execution.md @@ -26,7 +26,6 @@ To run the Semantic Version Checker on local changes: 1. To run the Semantic Version Checker, we need one folder with the feature changes and another folder with mainline code (without changes), so you may need to clone the Magento repository to a separate folder to perform the comparison. - 1. Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: ```bash From bb4d22be93985671517878d231c2d72c46a85690 Mon Sep 17 00:00:00 2001 From: Donald Booth Date: Mon, 12 Oct 2020 09:27:06 -0500 Subject: [PATCH 14/15] Strange linting error --- src/guides/v2.3/test/svc/semver_test_execution.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md index 35e99977d85..107100b3378 100644 --- a/src/guides/v2.3/test/svc/semver_test_execution.md +++ b/src/guides/v2.3/test/svc/semver_test_execution.md @@ -26,6 +26,7 @@ To run the Semantic Version Checker on local changes: 1. To run the Semantic Version Checker, we need one folder with the feature changes and another folder with mainline code (without changes), so you may need to clone the Magento repository to a separate folder to perform the comparison. + 1. Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: ```bash From dbbe394576f5b1a3e35d72d29b3c3af5d97ced74 Mon Sep 17 00:00:00 2001 From: Donald Booth Date: Mon, 12 Oct 2020 09:34:31 -0500 Subject: [PATCH 15/15] Linty --- src/guides/v2.3/test/svc/semver_test_execution.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/guides/v2.3/test/svc/semver_test_execution.md b/src/guides/v2.3/test/svc/semver_test_execution.md index 107100b3378..1322c0f510c 100644 --- a/src/guides/v2.3/test/svc/semver_test_execution.md +++ b/src/guides/v2.3/test/svc/semver_test_execution.md @@ -24,8 +24,7 @@ To run the Semantic Version Checker on local changes: cd magento-semver && composer install ``` -1. To run the Semantic Version Checker, we need one folder with the feature changes and another folder with mainline code (without changes), -so you may need to clone the Magento repository to a separate folder to perform the comparison. +1. To run the Semantic Version Checker, we need one folder with the feature changes and another folder with mainline code (without changes), so you may need to clone the Magento repository to a separate folder to perform the comparison. 1. Navigate the `magento-semver` folder and run the Semantic Version Checker compare command: