Skip to content

Commit d839076

Browse files
tomreecekaryna-tokolesnyklbajsarowiczrafaelstz
authored
MQE-2210: Merge DevDoc changes in master back into MFTF release branch (#749)
* Small fix to the Mftf Getting Started doc The command from the 'Set up an embedded MFTF -> Step 3' has to be executed from project root. * Update filter documentation with special characters to be able to show correctly in devdocs * DevDocs: Test merging precedence * Adding the Selenium server download in the example * Getting started > Removing code snippet I removed an unnecessary code snippet which doesn't make sense where it's. * DevDocs: Update Best Practices * Add missing information about Backend Domain support. * DevDocs: Update documentation regarding Versioning * DevDocs: Update documentation regarding Update process * Update Introduction for MFTF * Editorial pass * Escaped Liquid tag syntax * Fix an issue with MimeType guesser and latest release of "symfony/http-foundation" * Fix an issue with MimeType guesser and latest release of "symfony/http-foundation" * MQE-2052: MFTF uses undeclared dependency * MQE-2210: Merge DevDoc changes in master back into MFTF release branch Co-authored-by: Karyna Tsymbal <k.tsymbal@atwix.com> Co-authored-by: Alex Kolesnyk <kolesnyk@adobe.com> Co-authored-by: Lukasz Bajsarowicz <lukasz.bajsarowicz@gmail.com> Co-authored-by: Rafael Corrêa Gomes <rafaelstz@users.noreply.github.com> Co-authored-by: Kevin Kozan <kkozan@adobe.com> Co-authored-by: Donald Booth <dobooth@adobe.com> Co-authored-by: Kevin Kozan <kkozan@magento.com>
1 parent e5126f4 commit d839076

File tree

10 files changed

+184
-55
lines changed

10 files changed

+184
-55
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ Magento Functional Testing Framework Changelog
129129
2.6.3
130130
-----
131131

132+
### Fixes
133+
* added dependency to packages MFTF used but never specified in composer.json
134+
132135
### New Feature
133136
* `--filter` option was added to `bin/mftf generate:tests` command. For more details please go to https://devdocs.magento.com/mftf/docs/commands/mftf.html#generatetests
134137

docs/best-practices.md

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,49 @@
22

33
Check out our best practices below to ensure you are getting the absolute most out of the Magento Functional Testing Framework.
44

5+
## Focus on reusability
6+
7+
### Use existing Tests and resources
8+
9+
Magento offers more than **3000** acceptance tests, **2500** [Action group]s, **750** Page declarations with more than **1500** Section definitions.
10+
It is very probable that behaviour you want to test already exists as a Test or Action Group.
11+
Instead of writing everything by yourself - use `extends` attribute to refer to existing element and customize it.
12+
13+
**Reusable Resources**
14+
15+
{%raw%}
16+
17+
* Tests (reusable with `<test extends="...">` argument)
18+
* Action Group (reusable with including `<actionGroup ref="...">`, or extending `<actionGroup extends="...">`)
19+
* Pages (reusable with reference `{{PageDefinition.url}}`)
20+
* Sections (reusable with reference `{{SectionDefinition.elementDefinition}}`)
21+
* Data Entities (reusable with reference `<createData entity="...">"` or extending `<entity extends="...">`)
22+
23+
{%endraw%}
24+
25+
<div class="bs-callout bs-callout-warning" markdown="1">
26+
27+
Avoid using resources that are marked as **Deprecated**. Usually there is a replacement provided for a deprecated resource.
28+
29+
</div>
30+
31+
### Extract repetitive Actions
32+
33+
Instead of writing a few of Tests that perform mostly the same actions, you should thing about [Action group] that is a container for repetitive Actions.
34+
If each run needs different data, use `<arguments>` to inject necessary information.
35+
36+
We recommend to keep Action Groups having single responsibility, for example `AdminLoginActionGroup`, which expected outcome is being logged in as Administrator when [Action group] is executed.
37+
38+
## Contribute
39+
40+
Althought the Magento Core team and Contributors join forces to cover most of the features with tests, it is impossible to have this done quickly.
41+
If you've covered Magento Core feature with Functional Tests - you are more than welcome to contribute.
42+
43+
You can also help with MFTF Test Migration to get the experience and valuable feedback from other community members and maintainers.
44+
545
## Action group
646

7-
1. [Action group] names should be sufficiently descriptive to inform a test writer of what the action group does and when it should be used.
8-
Add additional explanation in annotations if needed.
47+
1. [Action group] names should be sufficiently descriptive to inform a test writer of what the action group does and when it should be used. Add additional explanation in annotations if needed.
948
2. Provide default values for the arguments that apply to your most common case scenarios.
1049
3. One `<actionGroup>` tag is allowed per action group XML file.
1150

@@ -95,20 +134,20 @@ Use the _Foo.camelCase_ naming convention, which is similar to _Classes_ and _cl
95134

96135
Use an upper case first letter for:
97136

98-
- File names. Example: _StorefrontCreateCustomerTest.xml_
99-
- Test name attributes. Example: `<test name="TestAllTheThingsTest">`
100-
- Data entity names. Example: `<entity name="OutOfStockProduct">`
101-
- Page name. Example: `<page name="AdminLoginPage">`
102-
- Section name. Example: `<section name="AdminCategorySidebarActionSection">`
103-
- Action group name. Example: `<actionGroup name="LoginToAdminActionGroup">`
137+
* File names. Example: _StorefrontCreateCustomerTest.xml_
138+
* Test name attributes. Example: `<test name="TestAllTheThingsTest">`
139+
* Data entity names. Example: `<entity name="OutOfStockProduct">`
140+
* Page name. Example: `<page name="AdminLoginPage">`
141+
* Section name. Example: `<section name="AdminCategorySidebarActionSection">`
142+
* Action group name. Example: `<actionGroup name="LoginToAdminActionGroup">`
104143

105144
#### Lower case
106145

107146
Use a lower case first letter for:
108147

109-
- Data keys. Example: `<data key="firstName">`
110-
- Element names. Examples: `<element name="confirmDeleteButton"/>`
111-
- Step keys. For example: `<click selector="..." stepKey="clickLogin"/>`
148+
* Data keys. Example: `<data key="firstName">`
149+
* Element names. Examples: `<element name="confirmDeleteButton"/>`
150+
* Step keys. For example: `<click selector="..." stepKey="clickLogin"/>`
112151

113152
## Page object
114153

@@ -147,9 +186,9 @@ Define these three elements and reference them by name in the tests.
147186
1. Keep your tests short and granular for target testing, easier reviews, and easier merge conflict resolution.
148187
It also helps you to identify the cause of test failure.
149188
1. Use comments to keep tests readable and maintainable:
150-
- Keep the inline `<!-- XML comments -->` and [`<comment>`] tags up to date.
189+
* Keep the inline `<!-- XML comments -->` and [`<comment>`] tags up to date.
151190
It helps to inform the reader of what you are testing and to yield a more descriptive Allure report.
152-
- Explain in comments unclear or tricky test steps.
191+
* Explain in comments unclear or tricky test steps.
153192
1. Refer to [sections] instead of writing selectors.
154193
1. One `<test>` tag is allowed per test XML file.
155194

@@ -178,3 +217,4 @@ Since the configurable product module could be disabled, this approach is more r
178217
[merging]: merging.html
179218
[parameterized selectors]: section/parameterized-selectors.html
180219
[sections]: section.html
220+
[MFTF Test Migration]: https://github.com/magento/magento-functional-tests-migration

docs/commands/mftf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ vendor/bin/mftf generate:tests [option] [<test name>] [<test name>] [--remove]
151151
| Option | Description|
152152
| ---| --- |
153153
| `--config=[<default> or <singleRun> or <parallel>]` | Creates a single manifest file with a list of all tests. The default location is `tests/functional/Magento/FunctionalTest/_generated/testManifest.txt`.<br/> You can split the list into multiple groups using `--config=parallel`; the groups will be generated in `_generated/groups/` like `_generated/groups/group1.txt, group2.txt, ...`.<br/> Available values: `default` (default), `singleRun`(same as `default`), and `parallel`.<br/> Example: `generate:tests --config=parallel`. |
154-
| `--filter` | Option to filter tests to be generated.<br/>Template: '<filterName>:<filterValue>'.<br/>Existing filter types: severity.<br/>Existing severity values: BLOCKER, CRITICAL, MAJOR, AVERAGE, MINOR.<br/>Example: --filter=severity:CRITICAL|
154+
| `--filter` | Option to filter tests to be generated.<br/>Template: '&lt;filterName&gt;:&lt;filterValue&gt;'.<br/>Existing filter types: severity.<br/>Existing severity values: BLOCKER, CRITICAL, MAJOR, AVERAGE, MINOR.<br/>Example: --filter=severity:CRITICAL|
155155
| `--force` | Forces test generation, regardless of the module merge order defined in the Magento instance. Example: `generate:tests --force`. |
156156
| `-i,--time` | Set time in minutes to determine the group size when `--config=parallel` is used. The __default value__ is `10`. Example: `generate:tests --config=parallel --time=15`|
157157
| `--tests` | Defines the test configuration as a JSON string.|

docs/configuration.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ Example:
3232
MAGENTO_BACKEND_NAME=admin_12346
3333
```
3434

35+
### MAGENTO_BACKEND_BASE_URL
36+
37+
(Optional) If you are running the Admin Panel on separate a domain, specify this value:
38+
39+
Example:
40+
41+
```conf
42+
MAGENTO_BACKEND_BASE_URL=https://admin.magento2.test
43+
```
44+
3545
### MAGENTO_ADMIN_USERNAME
3646

3747
The username that tests can use to access the Magento Admin page

docs/getting-started.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ Learn more about environmental settings in [Configuration][].
204204

205205
### Step 3. Enable the Magento CLI commands
206206

207-
In the `magento2/dev/tests/acceptance` directory, run the following command to enable the MFTF to send Magento CLI commands to your Magento instance.
207+
In the Magento project root, run the following command to enable the MFTF to send Magento CLI commands to your Magento instance.
208208

209209
```bash
210210
cp dev/tests/acceptance/.htaccess.sample dev/tests/acceptance/.htaccess
@@ -216,11 +216,11 @@ To run tests, you need a running Selenium server and [`mftf`][] commands.
216216

217217
#### Run the Selenium server {#selenium-server}
218218

219-
Run the Selenium server in terminal.
220-
For example, the following commands run the Selenium server for Google Chrome:
219+
Run the Selenium server in the terminal.
220+
For example, the following commands download and run the Selenium server for Google Chrome:
221221

222222
```bash
223-
cd <path_to_directory_with_selenium_server_and_webdriver>/
223+
curl -O http://selenium-release.storage.googleapis.com/3.14/selenium-server-standalone-3.14.0.jar
224224
```
225225

226226
```bash
@@ -233,10 +233,6 @@ java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone-3.14
233233
vendor/bin/mftf generate:tests
234234
```
235235

236-
```bash
237-
cd dev/tests/acceptance
238-
```
239-
240236
```bash
241237
vendor/bin/codecept run functional -c dev/tests/acceptance/codeception.yml
242238
```
124 KB
Loading

docs/introduction.md

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,80 @@ To find older documentation, please refer to the [docs folder] of your desired r
77

88
[Find your MFTF version][] of the MFTF.
99

10-
The Magento Functional Testing Framework (MFTF) aims to replace the [Functional Testing Framework] in future releases.
11-
MFTF improves:
10+
The Magento Functional Testing Framework (MFTF) is a framework used to perform automated end-to-end functional testing.
11+
12+
## Goals
13+
14+
- To facilitate functional testing and minimize the effort it takes to perform regression testing.
15+
- Enable extension developers to provide the Functional Tests to offered extensions.
16+
- Ensuring a common standard of quality between Magento, Extension Developers and System Intergrators.
17+
18+
MFTF also focuses on
1219

1320
- **Traceability** for clear logging and reporting capabilities.
1421
- **Modularity** to run tests based on installed modules and extensions.
1522
- **Customizability** for existing tests.
1623
- **Readability** using clear and declarative XML test steps.
1724
- **Maintainability** based on simple test creation and overall structure.
1825

19-
Because MFTF tests are written in XML, you no longer need to learn PHP to write tests.
26+
## Audience
2027

21-
<div class="bs-callout bs-callout-info" markdown="1">
22-
We are actively developing functional tests.
23-
Refer to `<magento_root>/app/code/<vendor_name>/<module_name>/Test/Mftf/` for examples.
24-
Check out the [MFTF Test Migration][] repo.
25-
</div>
28+
- **Contributors**: Tests build confidence about the results of changes introduced to the platform.
29+
- **Extension Developers**: Can adjust expected behaviour according to their customizations.
30+
- **System Integrators**: MFTF coverage provided out-of-the-box with Magento is solid base for Acceptance / Regression Tests.
2631

27-
## Audience
32+
## MFTF tests
2833

29-
This MFTF guide is intended for Magento developers and software engineers, such as QA specialists, PHP developers, and system integrators.
34+
The MFTF supports two different locations for storing the tests and test artifacts:
3035

31-
## Goals
36+
- `<magento_root>/app/code/<vendor_name>/<module_name>/Test/Mftf/` is the location of local, customized tests.
37+
- `<magento_root>/vendor/<vendor_name>/<module_name>/Test/Mftf/` is location of tests provided by Magento and vendors.
3238

33-
The purpose of MFTF is to:
39+
If you installed Magento with Composer, please refer to `vendor/magento/<module_dir>/Test/Mftf/` for examples.
3440

35-
- Facilitate functional testing and minimize the effort it takes to perform regression testing.
36-
- Make it easier to support the extension and customization of tests via XML merging.
41+
### Directory Structure
3742

38-
## Scope
43+
The file structure under both of the both path cases is the same:
44+
45+
```tree
46+
Test
47+
└── Mftf
48+
├── ActionGroup
49+
│   └── ...
50+
├── Data
51+
│   └── ...
52+
├── Metadata
53+
│   └── ...
54+
├── Page
55+
│   └── ...
56+
├── Section
57+
│   └── ...
58+
└── Test
59+
└── ...
60+
```
61+
62+
<div class="bs-callout bs-callout-info" markdown="1">
3963

40-
MFTF will enable you to:
64+
We are actively developing functional tests. Check out the [MFTF Test Migration][] repository.
4165

42-
- Test user interactions with web applications in testing.
43-
- Write functional tests located in `<magento_root>/app/code/<vendor_name>/<module_name>/Test/Mftf/`.
44-
- Cover basic functionality using out-of-the-box tests. You can test extended functionality using custom tests.
45-
- Automate regression testing.
66+
</div>
4667

4768
## Use cases
4869

49-
As a Magento developer, test changes, such as extended search functionality, a new form attribute, or new product tags.
70+
- Contributor: changes the core behaviour, fixing the annoing bug.
71+
He wants to have automated "supervisor" which is going to verify his work continuously across the stages of bug fixing. Finally, when fix is done - Functional Test is also proof of work done.
72+
- Extension Developer: offers extension that changes core behaviour.
73+
He can easily write new tests to make sure that after enabling the feature, Magento behaves properly. Everything with just extending existing tests. As a result he don't need to write coverage from scratch.
74+
- Integration Agency: maintains Client's e-commerce.
75+
They are able to customize tests delivered with Magento core to follow customizations implemented to Magento. After each upgrade they can just run the MFTF tests to know that no regression was introduced.
76+
77+
## MFTF output
5078

51-
As a software engineer, perform regression testing before release to ensure that Magento works as expected with new functionality.
79+
- Generated PHP Codeception tests
80+
- Codeception results and console logs
81+
- Screenshots and HTML failure report
82+
- Allure formatted XML results
83+
- Allure report dashboard of results
5284

5385
## Find your MFTF version
5486

@@ -57,22 +89,16 @@ There are two options to find out your MFTF version:
5789
- using the MFTF CLI
5890
- using the Composer CLI
5991

60-
### MFTF CLI
92+
All the Command Line commands needs to be executed from `<magento_root>`
6193

62-
```bash
63-
cd <magento_root>/
64-
```
94+
### MFTF CLI
6595

6696
```bash
6797
vendor/bin/mftf --version
6898
```
6999

70100
### Composer CLI
71101

72-
```bash
73-
cd <magento_root>/
74-
```
75-
76102
```bash
77103
composer show magento/magento2-functional-testing-framework
78104
```

docs/merging.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ For example:
2727
Although a file name does not influence merging, we recommend using the same file names in merging updates.
2828
This makes it easier to search later on.
2929

30+
## Merging precedence
31+
32+
**Magento Functional Testing Framework** uses Module's `<sequence>` to merge all XML configurations into Codeception instructions. If there's no Sequence specified, MFTF would use:
33+
34+
1. Vendor modules (Magento & Vendors) located in `vendor/`
35+
1. Tests located in `app/code/*/*/Test/Mftf`
36+
37+
![Usual precedence for merging MFTF Tests and resources][mftfExtendingPrecedence image]
38+
3039
## Add a test
3140

3241
You cannot add another [`<test>`][tests] using merging functionality.
@@ -570,3 +579,4 @@ The `_defaultSample` results corresponds to:
570579
[`<sections>`]: ./section.md
571580
[`<tests>`]: ./test.md
572581
[`<action groups>`]: ./test/action-groups.md
582+
[mftfExtendingPrecedence image]: img/mftf-extending-precedence.png

docs/update.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Update the Magento Functional Testing Framework
2+
3+
<div class="bs-callout bs-callout-info" markdown="1">
4+
Both Magento `2.2` and `2.3` supports MFTF `2.5.3` ([Find your version][] of the MFTF).
5+
</div>
6+
7+
Tests and the Framework itself are stored in different repositories.
8+
9+
* Tests are stored in Module's directory.
10+
* MFTF is installed separately (usually as a Composer dependency)
11+
12+
To understand different types of update - please follow the [Versioning][] page.
13+
14+
## Patch version update
15+
16+
Takes place when **third** digit of version number changes.
17+
18+
1. Make sure that [Security settings][] are set appropriately.
19+
1. Get latest Framework version with `composer update magento/magento2-functional-testing-framework --with-dependencies`
20+
1. Generate updated tests with `vendor/bin/mftf generate:tests`
21+
22+
## Minor version update
23+
24+
Takes place when **second** digit of version number changes.
25+
26+
1. Check details about backward incompatible changes in the [Changelog][] and update your new or customized tests.
27+
1. Perform all the actions provided for [Patch Version Update][]
28+
1. When updating from versions below `2.5.0`, verify [WYSIWYG settings][]
29+
1. You may need to run the `upgrade:tests` using `vendor/bin/mftf upgrade:tests app`
30+
31+
## After updating
32+
33+
1. It is a good idea to regenerate your IDE Schema Definition catalog with `vendor/bin/mftf generate:urn-catalog .idea/`
34+
1. Update your tests, including data, metadata and other resoruces. Check if they contain tags that are unsupported in the newer version.
35+
1. Remove the references to resources (ActionGroups, Sections, Tests) marked as deprecated.
36+
37+
<!-- Link Definitions -->
38+
[Changelog]: https://github.com/magento/magento2-functional-testing-framework/blob/master/CHANGELOG.md
39+
[WYSIWYG settings]: getting-started.md#wysiwyg-settings
40+
[Security settings]: getting-started.md#security-settings
41+
[Find your version]: introduction.md#find-your-mftf-version
42+
[Versioning]: versioning.md#versioning-policy
43+
[Patch Version Update]: #patch-version-update

docs/versioning.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ If a modification to MFTF forces tests to be changed, this is a backward incompa
1212
To find the version of MFTF that you are using, run the Magento CLI command:
1313

1414
```bash
15-
cd <magento_root>/
1615
vendor/bin/mftf --version
1716
```
1817

@@ -61,8 +60,10 @@ You must reset the patch and minor version to 0 when you change the major versio
6160
This table lists the version of the MFTF that was released with a particular version of Magento.
6261

6362
|Magento version| MFTF version|
64-
|---|---|
63+
|--- |--- |
64+
| 2.3.4 | 2.5.3 |
65+
| 2.3.3 | 2.4.5 |
6566
| 2.3.2 | 2.3.14 |
6667
| 2.3.1 | 2.3.13 |
67-
| 2.3.0 | 2.3.9 |
68+
| 2.3.0 | 2.3.9 |
6869
| 2.2.8 | 2.3.13 |

0 commit comments

Comments
 (0)