|
| 1 | +--- |
| 2 | +group: cloud-guide |
| 3 | +title: Functional testing in Docker |
| 4 | +functional_areas: |
| 5 | + - Cloud |
| 6 | + - Docker |
| 7 | + - Configuration |
| 8 | +--- |
| 9 | + |
| 10 | +You can use the `{{site.data.var.ct}}` package to run functional tests in the Docker environment. Functional tests are in the `src/Test/Functional/Acceptance` folder. See an example in the [ece-tools repository](https://github.com/magento/ece-tools/tree/develop/src/Test/Functional/Acceptance). |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +Before you run functional tests, you must prepare your environment with the following steps. |
| 15 | + |
| 16 | +1. Stop all services that use the following ports: |
| 17 | + |
| 18 | + - `80`—varnish |
| 19 | + - `443`—web, tls |
| 20 | + - `3306`—apache, mysql |
| 21 | + |
| 22 | +1. Switch to the preferred PHP version for running tests. |
| 23 | + |
| 24 | +1. Update the project dependencies. |
| 25 | + |
| 26 | + ```bash |
| 27 | + composer update |
| 28 | + ``` |
| 29 | + |
| 30 | +1. Add credentials to the Docker environment. |
| 31 | + |
| 32 | + ```bash |
| 33 | + echo "COMPOSER_MAGENTO_USERNAME=your_public_key" >> ./.docker/composer.env |
| 34 | + ``` |
| 35 | + |
| 36 | + ```bash |
| 37 | + echo "COMPOSER_MAGENTO_PASSWORD=your_private_key" >> ./.docker/composer.env |
| 38 | + ``` |
| 39 | + |
| 40 | +## Run tests |
| 41 | + |
| 42 | +By default, tests produce a short output. If you need a more detailed output, you can edit the `codeception.dist.yml` file and set the `printOutput:` property to `true`. !!! need location and example of `codeception.dist.yml` |
| 43 | + |
| 44 | +### Run a specific test |
| 45 | + |
| 46 | +Use the following format to run a specific functional test: |
| 47 | + |
| 48 | +```bash |
| 49 | +./vendor/bin/codecept run Acceptance <TestName>Cest |
| 50 | +``` |
| 51 | + |
| 52 | +For example, the following runs a test on the post deploy...explain more here... |
| 53 | + |
| 54 | +```bash |
| 55 | +./vendor/bin/codecept run Acceptance PostDeployCest |
| 56 | +``` |
| 57 | + |
| 58 | +Sample response: |
| 59 | + |
| 60 | +```terminal |
| 61 | +Need sample output here. |
| 62 | +``` |
| 63 | +{: .no-copy} |
| 64 | + |
| 65 | +### Run all tests |
| 66 | + |
| 67 | +The following lists the scripts to run all tests for each version of PHP. |
| 68 | + |
| 69 | +- **PHP 7.0** |
| 70 | + |
| 71 | + ```bash |
| 72 | + ./vendor/bin/codecept run -g php70 --steps |
| 73 | + ``` |
| 74 | + |
| 75 | +- **PHP 7.1** |
| 76 | + |
| 77 | + ```bash |
| 78 | + ./vendor/bin/codecept run -g php71 --steps |
| 79 | + ``` |
| 80 | + |
| 81 | +- **PHP 7.2** |
| 82 | + |
| 83 | + ```bash |
| 84 | + ./tests/travis/prepare_functional_parallel.sh |
| 85 | + ``` |
| 86 | + |
| 87 | + ```bash |
| 88 | + ./vendor/bin/codecept run -g php72parallel_1 --steps |
| 89 | + ``` |
| 90 | + |
| 91 | + ```bash |
| 92 | + ./vendor/bin/codecept run -g php72parallel_2 --steps |
| 93 | + ``` |
| 94 | + |
| 95 | + ```bash |
| 96 | + ./vendor/bin/codecept run -g php72parallel_3 --steps |
| 97 | + ``` |
0 commit comments