Skip to content

Commit e97567b

Browse files
committed
Merge branch 'master' into MFTF2.5.4-RC
2 parents 580d6dc + f627085 commit e97567b

File tree

12 files changed

+148
-35
lines changed

12 files changed

+148
-35
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
Magento Functional Testing Framework Changelog
22
================================================
3+
2.5.3
4+
-----
5+
6+
### Fixes
7+
* Fixed an issue where `createData` actions would cause an exception when used in `<suite>` hooks.
8+
9+
2.5.2
10+
-----
11+
12+
* Traceability
13+
* Allure report enhanced to display file path of tests.
14+
* Maintainability
15+
* Added support to read MFTF test entities from `<magento>dev/tests/acceptance/tests/functional/<vendor_name>/<module_name>/*`
16+
* Removed path deprecation warning from `ModuleResolver`.
17+
* Refactored problem methods to reduce cyclomatic complexity.
18+
19+
### Fixes
20+
* Fixed issue with builds due to absence of AcceptanceTester class.
21+
22+
### GitHub Issues/Pull requests:
23+
* [#348](https://github.com/magento/magento2-functional-testing-framework/pull/348) -- executeInSelenium command fixed to prevent escaping double quotes.
324

425
2.5.1
526
-----

bin/mftf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ try {
2929
try {
3030
$application = new Symfony\Component\Console\Application();
3131
$application->setName('Magento Functional Testing Framework CLI');
32-
$application->setVersion('2.5.1');
32+
$application->setVersion('2.5.3');
3333
/** @var \Magento\FunctionalTestingFramework\Console\CommandListInterface $commandList */
3434
$commandList = new \Magento\FunctionalTestingFramework\Console\CommandList;
3535
foreach ($commandList->getCommands() as $command) {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento2-functional-testing-framework",
33
"description": "Magento2 Functional Testing Framework",
44
"type": "library",
5-
"version": "2.5.1",
5+
"version": "2.5.3",
66
"license": "AGPL-3.0",
77
"keywords": ["magento", "automation", "functional", "testing"],
88
"config": {

composer.lock

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/commands/mftf.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ vendor/bin/mftf generate:tests
3939
### Generate tests by test name
4040

4141
```bash
42-
vendor/bin/mftf generate:tests LoginAsAdminTest LoginAsCustomerTest
42+
vendor/bin/mftf generate:tests AdminLoginTest StorefrontPersistedCustomerLoginTest
4343
```
4444

4545
### Generate and run the tests for a specified group
@@ -53,7 +53,7 @@ This command cleans up the previously generated tests; generates and runs tests
5353
### Generate and run particular tests
5454

5555
```bash
56-
vendor/bin/mftf run:test LoginAsAdminTest LoginAsCustomerTest -r
56+
vendor/bin/mftf run:test AdminLoginTest StorefrontPersistedCustomerLoginTest -r
5757
```
5858

5959
This command cleans up the previously generated tests; generates and runs the `LoginAsAdminTest` and `LoginAsCustomerTest` tests.
@@ -144,12 +144,12 @@ vendor/bin/mftf generate:tests [option] [<test name>] [<test name>] [--remove]
144144

145145
| Option | Description|
146146
| ---| --- |
147-
| `--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`. |
147+
| `--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`. |
148148
| `--force` | Forces test generation, regardless of the module merge order defined in the Magento instance. Example: `generate:tests --force`. |
149149
| `-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`|
150150
| `--tests` | Defines the test configuration as a JSON string.|
151151
| `--allow-skipped` | Allows MFTF to generate and run tests marked with `<skip>.`|
152-
| `--debug or --debug=[<none>]`| Performs schema validations on XML files. <br/> DEFAULT: `generate:tests` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. <br/> DEVELOPER: `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. This option takes extra processing time. Use it after test generation has failed once.</br><br/> NONE: `--debug=none` skips debugging during test generation. Added for backward compatibility, it will be removed in the next MAJOR release.</br>|
152+
| `--debug or --debug=[<none>]`| Performs schema validations on XML files. <br/> DEFAULT: `generate:tests` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered. <br/> DEVELOPER: `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. This option takes extra processing time. Use it after test generation has failed once.<br/>NONE: `--debug=none` skips debugging during test generation. Added for backward compatibility, it will be removed in the next MAJOR release.<br/>|
153153
| `-r,--remove`| Removes the existing generated suites and tests cleaning up the `_generated` directory before the actual run. For example, `generate:tests SampleTest --remove` cleans up the entire `_generated` directory and generates `SampleTest` only.|
154154

155155
#### Examples of the JSON configuration
@@ -447,9 +447,9 @@ vendor/bin/mftf setup:env
447447

448448
The example parameters are taken from the `etc/config/.env.example` file.
449449

450-
### `static:checks`
450+
### `static-checks`
451451

452-
Runs all MFTF static:checks on the test codebase that MFTF is currently attached to.
452+
Runs all MFTF static-checks on the test codebase that MFTF is currently attached to.
453453

454454
#### Existing static checks
455455

@@ -458,7 +458,7 @@ Runs all MFTF static:checks on the test codebase that MFTF is currently attached
458458
#### Usage
459459

460460
```bash
461-
vendor/bin/mftf static:checks
461+
vendor/bin/mftf static-checks
462462
```
463463

464464
### `upgrade:tests`

docs/getting-started.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<div class="bs-callout bs-callout-info" markdown="1">
44
[Find your MFTF version][] of the MFTF.
5-
The latest Magento 2.3 release supports MFTF 2.3.13.
6-
The latest Magento 2.2 release supports MFTF 2.3.8.
5+
The latest Magento 2.3.x release supports MFTF 2.4.5.
6+
The latest Magento 2.2.x release supports MFTF 2.4.5.
77
</div>
88

99
## Prepare environment {#prepare-environment}
@@ -97,6 +97,10 @@ bin/magento config:set admin/security/admin_account_sharing 1
9797
bin/magento config:set admin/security/use_form_key 0
9898
```
9999

100+
### Webserver configuration {#web-server-configuration}
101+
102+
The MFTF does not support executing CLI commands if your web server points to `<MAGE_ROOT_DIR>/pub` directory as recommended in the [Installation Guide][Installation Guide docroot]. For the MFTF to execute the CLI commands, the web server must point to the Magento root directory.
103+
100104
### Nginx settings {#nginx-settings}
101105

102106
If Nginx Web server is used on your development environment then **Use Web Server Rewrites** setting in **Stores** > Settings > **Configuration** > **Web** > **Search Engine Optimization** must be set to **Yes**.
@@ -340,3 +344,4 @@ allure serve dev/tests/_output/allure-results/
340344
[Set up a standalone MFTF]: #set-up-a-standalone-mftf
341345
[test suite]: suite.html
342346
[Find your MFTF version]: introduction.html#find-your-mftf-version
347+
[Installation Guide docroot]: https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Git vs Composer installation of Magento with MFTF
2+
3+
Depending on how you plan to use Magnto code, there are different options for installing Magento.
4+
5+
## GitHub Installation
6+
7+
If you are contributing a pull request to the Magento 2 codebase, download Magento 2 from our GitHub repository. Contribution to the codebase is done using the 'fork and pull' model where contributors maintain their own fork of the repo. This repo is then used to submit a pull request to the base repo.
8+
9+
Install guide: [GitHub Installation][]
10+
11+
## Composer based Installation
12+
13+
A Composer install downloads released packages of Magento 2 from the composer repo [https://repo.magento.com](https://repo.magento.com).
14+
15+
All Magento modules and their MFTF tests are put under `<vendor>` directory, for convenience of 3rd party developers. With this setup, you can keep your custom modules separate from core modules. You can also develop modules in a separate VCS repository and add them to your `composer.json` which installs them into the `vendor` directory.
16+
17+
Install guide: [Composer based Installation][]
18+
19+
## MFTF Installation
20+
21+
After installing your Magento project in either of the above ways, the composer dependency `magento/magento2-functional-testing-framework` downloads and installs MFTF. MFTF is embedded in your Magento 2 installation and will cover your project with functional tests.
22+
23+
If you want to contribute a pull request into MFTF codebase, you will need to install MFTF in the [Standalone][] mode.
24+
25+
## Managing modules - Composer vs GitHub
26+
27+
### Via GitHub
28+
29+
Cloning the Magento 2 git repository is a way of installing where you do not have to worry about matching your codebase with production. Your version control system generally holds and manages your `app/code` folder and you can do manual, ad-hoc development here.
30+
31+
### Via Composer
32+
33+
Magento advocates the use of composer for managing modules. When you install a module through composer, it is added to `vendor/<vendor-name>/<module>`.
34+
35+
When developing your own module or adding MFTF tests to a module, you should not edit in `vendor` because a composer update could overwrite your changes. Instead, overwrite a module under `vendor` by adding files or cloning your module-specific Git repo to `app/code/<vendor-name>/<module>`.
36+
37+
To distribute the module and its tests, you can initialize a git repo and create a [composer package][]. In this way others will be able to download and install your module and access your tests as a composer package, in their `<vendor>` folder.
38+
39+
## MFTF test materials location
40+
41+
- For GitHub installations, MFTF test materials are located in `<magento_root>/app/code/<vendor_name>/<module_name>/Test/Mftf/`. This is the directory for new tests or to maintain existing ones.
42+
- For Composer-based installations, MFTF test materials are located at `<magento_root>/vendor/<vendor_name>/<module_name>/Test/Mftf/`. This is the directory to run tests fetched by Composer.
43+
44+
The file structure under both paths is the same:
45+
46+
```tree
47+
<Path>
48+
├── ActionGroup
49+
│   └── ...
50+
├── Data
51+
│   └── ...
52+
├── Metadata
53+
│   └── ...
54+
├── Page
55+
│   └── ...
56+
├── Section
57+
│   └── ...
58+
└── Test
59+
└── ...
60+
```
61+
62+
## How ModuleResolver reads modules
63+
64+
With either type of installation, all tests and test data are read and merged by MFTF's ModuleResolver in this order:
65+
66+
1. `<magento_root>/app/code/<vendor_name>/<module_name>/Test/Mftf/`
67+
1. `<magento_root>/vendor/<vendor_name>/<module_name>/Test/Mftf/`
68+
69+
## Conclusion
70+
71+
There is no difference between having the test materials in `app/code` or in `/vendor`: it works the same. Composer-based installs may benefit teams when there is a need to match file systems in `development` and `production`.
72+
73+
If you are a contributing developer with an understanding of Git and Composer commands, you can choose the GitHub installation method instead.
74+
75+
<!-- Link definitions -->
76+
77+
[Composer based Installation]: https://devdocs.magento.com/guides/v2.3/install-gde/composer.html
78+
[GitHub Installation]: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/dev_install.html
79+
[Standalone]: ../getting-started.html#set-up-a-standalone-mftf
80+
[composer package]: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/package/package_module.html

docs/merge_points/extend-data.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Extend data entities
22

3-
Extending an action group doesn't affect the existing action group.
3+
Extending a data entity does not affect the existing data entity.
44

5-
In this example we add a `<click>` command to check the checkbox that our extension added with a new action group for the simple product creation form.
5+
In this example we update the quantity to 1001 and add a new piece of data relevant to our extension. Unlike merging, this will _not_ affect any other tests that use this data entity.
66

77
## Starting entity
88

@@ -67,4 +67,4 @@ Note that there are now two data entities below.
6767
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
6868
<data key="myExtensionData">dataHere</data>
6969
</entity>
70-
```
70+
```

docs/merge_points/extend-tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Extend tests
22

3-
Data objects can be merged to cover the needs of your extension.
3+
Tests can be extended to cover the needs of your extension.
44

55
In this example, we add an action group to a new copy of the original test for our extension.
66

@@ -142,4 +142,4 @@ Note that there are now two tests below.
142142
<argument name="extensionData" value="_myData"/>
143143
</actionGroup>
144144
</test>
145-
```
145+
```

docs/suite.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Suites
22

3-
Suites are essentially groups of tests that run in the specific conditions (preconditions and postconditions).
4-
They enable you including, excluding, and grouping tests for a customized test run when you need it.
3+
Suites are essentially groups of tests that run in specific conditions (preconditions and postconditions).
4+
They enable including, excluding, and grouping tests for a customized test run.
55
You can form suites using separate tests, groups, and modules.
66

77
Each suite must be defined in the `<VendorName>/<ModuleName>/Test/Mftf/Suite` directory.
@@ -19,7 +19,6 @@ The format of a suite:
1919

2020
```xml
2121
<?xml version="1.0" encoding="UTF-8"?>
22-
2322
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Suite/etc/suiteSchema.xsd">
2423
<suite name="">
2524
<before>
@@ -43,12 +42,14 @@ The format of a suite:
4342
## Principles
4443

4544
- A suite name:
46-
- must not match any existing group value.
45+
46+
- must not match any existing group value.
4747
For example, the suite `<suite name="ExampleTest">` will fail during test run if any test contains in annotations `<group value="ExampleTest">`.
48-
- must not be `default` or `skip`. Tests that are not in any suite are generated under the `default` suite.
49-
The suite name `skip` is synonymous to including a test in the `<group value="skip"/>`, which will be deprecated in MFTF 3.0.0.
50-
- can contain letters, numbers, and underscores.
51-
- should be upper camel case.
48+
- must not be `default` or `skip`. Tests that are not in any suite are generated under the `default` suite.
49+
The suite name `skip` is synonymous to including a test in the `<group value="skip"/>`, which will be deprecated in MFTF 3.0.0.
50+
- can contain letters, numbers, and underscores.
51+
- should be upper camel case.
52+
5253
- A suite must contain at least one `<include>`, or one `<exclude>`, or both.
5354
- Using `<before>` in a suite, you must add the corresponding `<after>` to restore the initial state of your testing instance.
5455

@@ -133,7 +134,7 @@ It performs the following steps:
133134
*After* the testing, the suite returns the Magento instance to the initial state disabling WYSIWYG:
134135

135136
1. Log back in.
136-
2. Disable **WYSIWYG** so that
137+
2. Disable **WYSIWYG** in the Magento instance.
137138

138139
This suite includes all tests that contain the `<group value="WYSIWYG"/>` annotation.
139140

@@ -242,11 +243,11 @@ The element can contain [`<test>`], [`<group>`], and [`<module>`].
242243

243244
A set of filters that you can use to specify which tests to exclude in the test suite.
244245

245-
There two types of behavior:
246+
There are two types of behavior:
246247

247248
1. Applying filters to the included tests when the suite contains [`<include>`] filters.
248249
The MFTF will exclude tests from the previously included set and generate the remaining tests in the suite.
249-
2. Applying filter to all tests when the suite does not contain [`<include>`] filters.
250+
2. Applying filters to all tests when the suite does not contain [`<include>`] filters.
250251
The MFTF will generate all existing tests except the excluded.
251252
In this case, the custom suite will contain all generated tests except excluded, and the _default_ suite will contain the excluded tests only.
252253

src/Magento/FunctionalTestingFramework/Allure/AllureHelper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public static function addAttachmentToLastStep($data, $caption)
3535
$rootStep = Allure::lifecycle()->getStepStorage()->getLast();
3636
$trueLastStep = array_last($rootStep->getSteps());
3737

38+
if ($trueLastStep == null) {
39+
// Nothing to attach to; do not fire off allure event
40+
return;
41+
}
42+
3843
$attachmentEvent = new AddUniqueAttachmentEvent($data, $caption);
3944
$attachmentEvent->process($trueLastStep);
4045
}

src/Magento/FunctionalTestingFramework/StaticCheck/TestDependencyCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class TestDependencyCheck implements StaticCheckInterface
6666
* Array containing all errors found after running the execute() function.
6767
* @var array
6868
*/
69-
private $errors;
69+
private $errors = [];
7070

7171
/**
7272
* String representing the output summary found after running the execute() function.

0 commit comments

Comments
 (0)