|
1 | 1 | # How to use MFTF in CICD
|
2 | 2 |
|
3 |
| -If you want to integrate MFTF tests into your CICD pipeline, then it's best to start with the conceptual flow of the pipeline code. |
| 3 | +To integrate MFTF tests into your CICD pipeline, then it is best to start with the conceptual flow of the pipeline code. |
4 | 4 |
|
5 | 5 | ## Concept
|
6 | 6 |
|
7 |
| -The overall workflow that tests should follow is thus: |
| 7 | +The overall workflow that tests should follow is: |
8 | 8 |
|
9 |
| -* Obtain Magento instance + install pre-requisites |
10 |
| -* Generate tests for running |
11 |
| - * Options for single/parallel running |
12 |
| -* Delegate and run tests + gather test run artifacts |
13 |
| - * Re-run options |
14 |
| -* Generate Allure report from aggregate |
| 9 | +- Obtain a Magento instance + install pre-requisites. |
| 10 | +- Generate the tests. |
| 11 | + - Set options for single or parallel running. |
| 12 | +- Delegate and run tests and gather test-run artifacts. |
| 13 | + - Re-run options. |
| 14 | +- Generate the Allure reports from results. |
15 | 15 |
|
16 |
| -### Obtain Magento instance |
| 16 | +## Obtain a Magento instance |
17 | 17 |
|
18 |
| -To start, we need a Magento instance to operate against for generation and execution. |
| 18 | +To start, we need a Magento instance to operate against for test generation and execution. |
19 | 19 |
|
| 20 | +```bash |
| 21 | +git clone https://github.com/magento/magento2 |
20 | 22 | ```
|
21 |
| -$ git clone https://github.com/magento/magento2 |
| 23 | + |
22 | 24 | or
|
23 |
| -$ composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento2ce |
| 25 | + |
| 26 | +```bash |
| 27 | +composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento2ce |
24 | 28 | ```
|
25 | 29 |
|
26 | 30 | For more information on installing magento see [Install Magento using Composer].
|
27 | 31 |
|
28 | 32 | After installing the Magento instance, you need to set a couple of configurations to the magento instance:
|
29 | 33 |
|
30 |
| -``` |
31 |
| -$ bin/magento config:set general/locale/timezone America/Los_Angeles |
32 |
| -$ bin/magento config:set admin/security/admin_account_sharing 1 |
33 |
| -$ bin/magento config:set admin/security/use_form_key 0 |
34 |
| -$ bin/magento config:set cms/wysiwyg/enabled disabled |
| 34 | +```bash |
| 35 | +bin/magento config:set general/locale/timezone America/Los_Angeles |
| 36 | +bin/magento config:set admin/security/admin_account_sharing 1 |
| 37 | +bin/magento config:set admin/security/use_form_key 0 |
| 38 | +bin/magento config:set cms/wysiwyg/enabled disabled |
35 | 39 | ```
|
36 | 40 |
|
37 |
| -These help set the state for the `default` state of the Magento instance. If you are wanting to change the default state of the application (and have merged into the tests sufficiently to account for it), this is the step in which you would do it. |
| 41 | +These help set the `default` state of the Magento instance. If you wish to change the default state of the application (and have updated your tests sufficiently to account for it), this is the step in which you would do it. |
38 | 42 |
|
39 |
| -#### Install allure |
| 43 | +## Install allure |
40 | 44 |
|
41 | 45 | This will be required to generate the report after your test runs. See [Allure] for details.
|
42 | 46 |
|
| 47 | +## Generate tests |
43 | 48 |
|
44 |
| -### Generate tests |
45 |
| - |
46 |
| -#### Single execution |
| 49 | +### Single execution |
47 | 50 |
|
48 |
| -Simply generate tests based on what you want to run: |
| 51 | +Generate tests based on what you want to run: |
49 | 52 |
|
50 |
| -``` |
51 |
| -$ vendor/bin/mftf generate:tests |
| 53 | +```bash |
| 54 | +vendor/bin/mftf generate:tests |
52 | 55 | ```
|
53 | 56 |
|
54 |
| -This will generate all tests, and a single manifest file under `dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/testManifest.txt` |
| 57 | +This will generate all tests and a single manifest file under `dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/testManifest.txt` |
55 | 58 |
|
56 |
| -#### Parallel execution |
| 59 | +### Parallel execution |
57 | 60 |
|
58 | 61 | To generate all tests for use in parallel nodes:
|
59 | 62 |
|
60 |
| -``` |
61 |
| -$ vendor/bin/mftf generate:tests --config parallel |
| 63 | +```bash |
| 64 | +vendor/bin/mftf generate:tests --config parallel |
62 | 65 | ```
|
63 | 66 |
|
64 | 67 | This will generate a folder under `dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/groups`. This folder contains several `group#.txt` files that can be used later with the `mftf run:manifest` command.
|
65 | 68 |
|
66 |
| -### Delegate and run tests |
| 69 | +## Delegate and run tests |
67 | 70 |
|
68 |
| -#### Single execution |
69 |
| -If you are running on a single node, this step is simply to call: |
| 71 | +### Single execution |
70 | 72 |
|
| 73 | +If you are running on a single node, call: |
| 74 | + |
| 75 | +```bash |
| 76 | +vendor/bin/mftf run:manifest dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/testManifest.txt |
71 | 77 | ```
|
72 |
| -$ vendor/bin/mftf run:manifest dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/testManifest.txt |
73 |
| -``` |
74 | 78 |
|
75 |
| -#### Parallel execution |
76 |
| -To run MFTF tests in parallel, you will need to clone the contents of the current node and duplicate them depending on how many nodes you have available for use. |
| 79 | +### Parallel execution |
| 80 | + |
| 81 | +To run MFTF tests in parallel, clone the contents of the current node and duplicate them depending on how many nodes you have. |
| 82 | + |
| 83 | +- Clone contents of current node as a baseline. |
| 84 | +- For each `groups/group#.txt` file: |
77 | 85 |
|
78 |
| -* Clone contents of current node as a baseline |
79 |
| -* For each `groups/group#.txt` file: |
80 |
| - * Set a node's contents to the baseline |
81 |
| - * Run `vendor/bin/mftf run:manifest <current_group.txt>` |
82 |
| - * Gather artifacts from `dev/tests/acceptance/tests/_output` from current node to master |
| 86 | + - Set a node's contents to the baseline. |
| 87 | + - Run `vendor/bin/mftf run:manifest <current_group.txt>`. |
| 88 | + - Gather artifacts from `dev/tests/acceptance/tests/_output` from current node to master. |
83 | 89 |
|
84 | 90 | #### Rerun options
|
85 |
| -In either single or parallel execution, to re-run failed tests simply add a `run:failed` command after executing a manifest: |
86 | 91 |
|
87 |
| -``` |
88 |
| -$ vendor/bin/mftf run:failed |
| 92 | +In either single or parallel execution, to re-run failed tests simply add the `run:failed` command after executing a manifest: |
| 93 | + |
| 94 | +```bash |
| 95 | +vendor/bin/mftf run:failed |
89 | 96 | ```
|
90 | 97 |
|
91 | 98 | ### Generate Allure report
|
92 | 99 |
|
93 | 100 | In the master node, simply generate using your `<path_to_results>` into a desired output path
|
94 | 101 |
|
95 |
| -``` |
96 |
| -$ allure generate <path_to_results> -c -o <path_to_output> |
| 102 | +```bash |
| 103 | +allure generate <path_to_results> -c -o <path_to_output> |
97 | 104 | ```
|
98 | 105 |
|
99 | 106 | <!-- Link definitions -->
|
|
0 commit comments