|
1 | 1 | # Using suites
|
2 | 2 |
|
3 |
| -With increasing number of MFTF tests, it's important to have a mechanism to organize and consolidate them for ease-of-use. |
| 3 | +With an increasing number of MFTF tests, it is important to have a mechanism to organize and consolidate them for ease-of-use. |
4 | 4 |
|
5 | 5 | ### What is a suite?
|
6 | 6 |
|
7 |
| -Suite is a collection of MFTF tests that are intended to test specific behaviors of Magento. It may contain common initialization and clean up steps specific to the test cases included. It allows you to include, exclude and/or group tests with preconditions and post conditions. |
| 7 | +A suite is a collection of MFTF tests that are intended to test specific behaviors of Magento. It may contain initialization and clean up steps common to the included test cases. It allows you to include, exclude and/or group tests with preconditions and post conditions. |
8 | 8 | You can create a suite referencing tests, test groups and modules.
|
9 | 9 |
|
10 | 10 | ### How is a suite defined?
|
11 | 11 |
|
12 |
| -A suite should be created under `<magento 2 root>/dev/tests/acceptance/tests/_suite` if it has cross-module references. If a suite references only a specific module, it should be created under `<module>/Test/Mftf/Suite`. The generated tests for each suite are grouped into their own directory under `<magento 2 root>/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/`. |
| 12 | +A suite should be created under `<magento2 root>/dev/tests/acceptance/tests/_suite` if it has cross-module references. If a suite references only a single module, it should be created under `<module>/Test/Mftf/Suite`. The generated tests for each suite are grouped into their own directory under `<magento2 root>/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/`. |
13 | 13 |
|
14 | 14 | ### What is the format of a suite?
|
15 | 15 |
|
16 |
| -A suite comprises of the below blocks: |
| 16 | +A suite is comprised of blocks: |
17 | 17 |
|
18 |
| -* `<before>` : executes precondition once per suite run. |
19 |
| -* `<after>` : executes postcondition once per suite run. |
20 |
| -* `<include>`: includes specific tests/groups/modules in the suite. |
21 |
| -* `<exclude>`: excludes specific tests/groups/modules from the suite. |
| 18 | +* `<before>` : executes precondition once per suite run. |
| 19 | +* `<after>` : executes postcondition once per suite run. |
| 20 | +* `<include>`: includes specific tests/groups/modules in the suite. |
| 21 | +* `<exclude>`: excludes specific tests/groups/modules from the suite. |
22 | 22 |
|
23 | 23 | ```xml
|
24 | 24 | <?xml version="1.0" encoding="UTF-8"?>
|
@@ -65,34 +65,37 @@ A suite comprises of the below blocks:
|
65 | 65 | ```
|
66 | 66 |
|
67 | 67 | This example declares a suite with name `WYSIWYGDisabledSuite`:
|
68 |
| -* Disables WYSIWYG of the Magento instance before running the tests. |
69 |
| -* Runs all tests from `Catalog` module, except `WYSIWYGIncompatibleTest` |
70 |
| -* Returns the Magento instance back to it's original state by enabling WYSIWYG at the end of testing. |
| 68 | + |
| 69 | +* Disables WYSIWYG of the Magento instance before running the tests. |
| 70 | +* Runs all tests from the `Catalog` module, except `WYSIWYGIncompatibleTest` |
| 71 | +* Returns the Magento instance back to its original state, by enabling WYSIWYG at the end of testing. |
71 | 72 |
|
72 | 73 | ### Using MFTF suite commands
|
73 | 74 |
|
74 |
| -* Generate all tests within a suite. |
75 |
| -```bash |
76 |
| - vendor/bin/mftf generate:suite <suiteName> [<suiteName>] |
77 |
| -``` |
78 |
| -* Run all tests within suite. |
79 |
| -```bash |
80 |
| - vendor/bin/mftf run:group <suiteName> [<suiteName>] |
81 |
| -``` |
82 |
| -* Generates any combination of suites and tests. |
83 |
| -```bash |
84 |
| - vendor/bin/mftf generate:tests --tests '{"tests":["testName1","testName2"],"suites":{"suite1":["suite_test1"],"suite2":null}}' |
85 |
| -``` |
| 75 | +* Generate all tests within a suite. |
| 76 | + |
| 77 | + ```bash |
| 78 | + vendor/bin/mftf generate:suite <suiteName> [<suiteName>] |
| 79 | + ``` |
| 80 | +* Run all tests within suite. |
| 81 | + |
| 82 | + ```bash |
| 83 | + vendor/bin/mftf run:group <suiteName> [<suiteName>] |
| 84 | + ``` |
| 85 | +* Generates any combination of suites and tests. |
| 86 | + |
| 87 | + ```bash |
| 88 | + vendor/bin/mftf generate:tests --tests '{"tests":["testName1","testName2"],"suites":{"suite1":["suite_test1"],"suite2":null}}' |
| 89 | + ``` |
86 | 90 |
|
87 |
| -### How to run specific tests within a suite? |
| 91 | +### Run specific tests within a suite |
| 92 | + |
| 93 | +If a test is referenced in a suite, it can be run in the suite's context with MFTF `run` command. If a test is referenced in multiple suites, the `run` command will run the test multiple times in all contexts. |
88 | 94 |
|
89 |
| -If a test is referenced in a suite, it can be run in the suite's context with MFTF run command. If a test is referenced in multiple suites, the run command will run the test multiple times in all contexts. |
90 | 95 | ```bash
|
91 |
| - vendor/bin/mftf run:test <testName> [<testName>] |
| 96 | +vendor/bin/mftf run:test <testName> [<testName>] |
92 | 97 | ```
|
93 | 98 |
|
94 | 99 | ### When to use suites?
|
95 | 100 |
|
96 |
| -Suites are a great way to organize tests which need magento environment to be configured in a specific way as a pre-requisite. The conditions are executed once per suite which optimizes test execution time. If you wish to categorize tests solely based on functionality, use group tags instead. |
97 |
| - |
98 |
| -<!-- Link definitions --> |
| 101 | +Suites are a great way to organize tests which need the Magento environment to be configured in a specific way as a pre-requisite. The conditions are executed once per suite which optimizes test execution time. If you wish to categorize tests solely based on functionality, use group tags instead. |
0 commit comments