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..0017cd21baf 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/svc/semver_test_execution.html \ 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..65b0f517445 --- /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 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, create a new testsuite for phpunit: + +1. From the Magento base directory navigate to `dev/tests/static/testsuite/Magento/Test` + +1. Create a copy of the `Php` folder on the same directory and rename it to `Local` + +1. Navigate to `dev/tests/static/testsuite/Magento/Test/Local/_files/whitelist` and open `common.txt` + +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 + ``` + +1. Create a copy of the `dev/tests/static/phpunit.xml.dist` file and call it `phpunit.xml`: + +1. Add a new testsuite to the `dev/tests/static/phpunit.xml` file inside the `` node: + + ```xml + + ... + + testsuite/Magento/Test/Local/LiveCodeTest.php + + + ``` + +1. Navigate to the Magento base directory and run: + + ```bash + ./vendor/bin/phpunit --testsuite="Local Test Suite" -c dev/tests/static/phpunit.xml.dist + ``` + +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. 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..1322c0f510c --- /dev/null +++ b/src/guides/v2.3/test/svc/semver_test_execution.md @@ -0,0 +1,36 @@ +--- +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. + +### Running Semantic Version Checker on local changes + +To run the Semantic Version Checker on local changes: + +1. Clone the `magento-semver` tool to your local machine: + + ```bash + git clone git@github.com:magento/magento-semver.git + ``` + +1. Navigate to the cloned repository and run `composer install` to install the project dependencies: + + ```bash + 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. 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 folder with your changes. +The results of the Semantic Version Checker are outputted to the console. 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 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