Skip to content

Commit 76a0892

Browse files
authored
Merge pull request #473 from magento-devdocs/db_mftf_linting
MFTF linting cleanup
2 parents 6675ee5 + 521475c commit 76a0892

24 files changed

+227
-228
lines changed

docs/best-practices.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,19 @@ Use the _Foo.camelCase_ naming convention, which is similar to _Classes_ and _cl
8484

8585
Use an upper case first letter for:
8686

87-
- File names. Example: _StorefrontCreateCustomerTest.xml_
88-
- Test name attributes. Example: `<test name="TestAllTheThingsTest">`.
89-
- Data entity names. Example: `<entity name="OutOfStockProduct">`.
90-
- Page name. Example: `<page name="AdminLoginPage">`.
91-
- Section name. Example: `<section name="AdminCategorySidebarActionSection">`.
92-
- Action group name. Example: `<actionGroup name="LoginToAdminActionGroup">`.
87+
- File names. Example: _StorefrontCreateCustomerTest.xml_
88+
- Test name attributes. Example: `<test name="TestAllTheThingsTest">`.
89+
- Data entity names. Example: `<entity name="OutOfStockProduct">`.
90+
- Page name. Example: `<page name="AdminLoginPage">`.
91+
- Section name. Example: `<section name="AdminCategorySidebarActionSection">`.
92+
- Action group name. Example: `<actionGroup name="LoginToAdminActionGroup">`.
9393

9494
#### Lower case
9595

9696
Use a lower case first letter for:
9797

98-
- Data keys. Example: `<data key="firstName">`.
99-
- Element names. Examples: `<element name="confirmDeleteButton"/>`.
98+
- Data keys. Example: `<data key="firstName">`.
99+
- Element names. Examples: `<element name="confirmDeleteButton"/>`.
100100

101101
## Page object
102102

@@ -134,9 +134,9 @@ Define these three elements and reference them by name in the tests.
134134
1. Keep your tests short and granular for target testing, easier reviews, and easier merge conflict resolution.
135135
It also helps you to identify the cause of test failure.
136136
1. Use comments to keep tests readable and maintainable:
137-
- Keep the inline `<!-- XML comments -->` and [`<comment>`] tags up to date.
137+
- Keep the inline `<!-- XML comments -->` and [`<comment>`] tags up to date.
138138
It helps to inform the reader of what you are testing and to yield a more descriptive Allure report.
139-
- Explain in comments unclear or tricky test steps.
139+
- Explain in comments unclear or tricky test steps.
140140
1. Refer to [sections] instead of writing selectors.
141141

142142
## Test step merging order

docs/credentials.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ Credentials can be used in actions: [`fillField`][], [`magentoCLI`][], and [`cre
148148

149149
Define the value as a reference to the corresponding key in the credentials file or vault such as `{{_CREDS.my_data_key}}`:
150150

151-
- `_CREDS` is an environment constant pointing to the `.credentials` file
152-
- `my_data_key` is a key in the the `.credentials` file or vault that contains the value to be used in a test step
151+
- `_CREDS` is an environment constant pointing to the `.credentials` file
152+
- `my_data_key` is a key in the the `.credentials` file or vault that contains the value to be used in a test step
153153

154154
For example, reference secret data in the [`fillField`][] action with the `userInput` attribute.
155155

docs/data.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ userInput="{{SimpleSubCategory.name}}"
1717

1818
In this example:
1919

20-
* `SimpleSubCategory` is an entity name.
21-
* `name` is a `<data>` key of the entity. The corresponding value will be assigned to `userInput` as a result.
20+
* `SimpleSubCategory` is an entity name.
21+
* `name` is a `<data>` key of the entity. The corresponding value will be assigned to `userInput` as a result.
2222

2323
### Environmental data
2424

@@ -28,8 +28,8 @@ userInput="{{_ENV.MAGENTO_ADMIN_USERNAME}}"
2828

2929
In this example:
3030

31-
* `_ENV` is a reference to the `dev/tests/acceptance/.env` file, where basic environment variables are set.
32-
* `MAGENTO_ADMIN_USERNAME` is a name of an environment variable.
31+
* `_ENV` is a reference to the `dev/tests/acceptance/.env` file, where basic environment variables are set.
32+
* `MAGENTO_ADMIN_USERNAME` is a name of an environment variable.
3333
The corresponding value will be assigned to `userInput` as a result.
3434

3535
### Sensitive data
@@ -40,10 +40,10 @@ userInput="{{_CREDS.my_secret_token}}"
4040

4141
In this example:
4242

43-
* `_CREDS` is a constant to reference to the `dev/tests/acceptance/.credentials` file, where sensitive data and secrets are stored for use in a test.
44-
* `MY_SECRET_TOKEN` is the name of a key in the credentials variable.
43+
* `_CREDS` is a constant to reference to the `dev/tests/acceptance/.credentials` file, where sensitive data and secrets are stored for use in a test.
44+
* `MY_SECRET_TOKEN` is the name of a key in the credentials variable.
4545
The corresponding value of the credential will be assigned to `userInput` as a result.
46-
* The decrypted values are only available in the `.credentials` file in which they are stored.
46+
* The decrypted values are only available in the `.credentials` file in which they are stored.
4747

4848
Learn more in [Credentials][].
4949

@@ -59,8 +59,8 @@ userInput="$createCustomer.email$"
5959

6060
In this example:
6161

62-
* `createCustomer` is a step key of the corresponding test step that creates an entity.
63-
* `email` is a data key of the entity.
62+
* `createCustomer` is a step key of the corresponding test step that creates an entity.
63+
* `email` is a data key of the entity.
6464
The corresponding value will be assigned to `userInput` as a result.
6565

6666
<div class="bs-callout bs-callout-info">
@@ -118,10 +118,10 @@ The format of `<data>` is:
118118

119119
The following conventions apply to MFTF `<data>`:
120120

121-
* A `<data>` file may contain multiple data entities.
122-
* Camel case is used for `<data>` elements. The name represents the `<data>` type. For example, a file with customer data is `CustomerData.xml`. A file for simple product would be `SimpleProductData.xml`.
123-
* Camel case is used for the entity name.
124-
* The file name must have the suffix `Data.xml`.
121+
* A `<data>` file may contain multiple data entities.
122+
* Camel case is used for `<data>` elements. The name represents the `<data>` type. For example, a file with customer data is `CustomerData.xml`. A file for simple product would be `SimpleProductData.xml`.
123+
* Camel case is used for the entity name.
124+
* The file name must have the suffix `Data.xml`.
125125

126126
## Example
127127

@@ -152,16 +152,16 @@ All entities that have the same name will be merged during test generation. Both
152152

153153
`_defaultCategory` sets three data fields:
154154

155-
* `name` defines the category name as `simpleCategory` with a unique suffix. Example: `simpleCategory598742365`.
156-
* `name_lwr` defines the category name in lowercase format with a unique suffix. Example: `simplecategory697543215`.
157-
* `is_active` sets the enable category to `true`.
155+
* `name` defines the category name as `simpleCategory` with a unique suffix. Example: `simpleCategory598742365`.
156+
* `name_lwr` defines the category name in lowercase format with a unique suffix. Example: `simplecategory697543215`.
157+
* `is_active` sets the enable category to `true`.
158158

159159
`SimpleSubCategory` sets four data fields:
160160

161-
* `name` that defines the category name with a unique suffix. Example: `SimpleSubCategory458712365`.
162-
* `name_lwr` that defines the category name in lowercase format with a unique suffix. Example: `simplesubcategory753698741`.
163-
* `is_active` sets the enable category to `true`.
164-
* `include_in_menu` that sets the include in the menu to `true`.
161+
* `name` that defines the category name with a unique suffix. Example: `SimpleSubCategory458712365`.
162+
* `name_lwr` that defines the category name in lowercase format with a unique suffix. Example: `simplesubcategory753698741`.
163+
* `is_active` sets the enable category to `true`.
164+
* `include_in_menu` that sets the include in the menu to `true`.
165165

166166
The following is an example of a call in test:
167167

docs/debugging.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
Debugging within the Magento Functional Testing Framework is helpful in identifying test bugs by allowing you to pause execution so that you may:
44

5-
- Examine the page.
6-
- Check returned data and other variables being used during run-time.
5+
- Examine the page.
6+
- Check returned data and other variables being used during run-time.
77

88
This is straightforward to do once you create a basic Debug Configuration.
99

1010
## Prerequisites
1111

12-
- [Xdebug][]
13-
- PHPUnit configured for use in [PHPStorm][]
12+
- [Xdebug][]
13+
- PHPUnit configured for use in [PHPStorm][]
1414

1515
## Creating Debug Configuration with PHPStorm
1616

@@ -27,8 +27,8 @@ If you get a warning `Path to Codeception for local machine is not configured.`:
2727

2828
The easiest method of tagging a test for debugging is the following:
2929

30-
- In your Debug configuration, locate `Test Runner options:` and set `--group testDebug`.
31-
- When you want to debug a test you are working on, simply add `<group value="testDebug"/>` to the annotations. Be sure to remove this after done debugging.
30+
- In your Debug configuration, locate `Test Runner options:` and set `--group testDebug`.
31+
- When you want to debug a test you are working on, simply add `<group value="testDebug"/>` to the annotations. Be sure to remove this after done debugging.
3232

3333
Your Debug Configuration should now be able to run your test and pause execution on any breakpoints you have set in the generated `.php` file under the `_generated` folder.
3434

docs/extending.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ For example, only one or two parameters (for example, URL) might vary between te
55
To avoid copy-pasting and to save some time the Magento Functional Testing Framework (MFTF) enables you to extend test components such as [test], [data], and [action group].
66
You can create or update any component of the parent body in your new test/action group/entity.
77

8-
* A test starting with `<test name="SampleTest" extends="ParentTest">` creates a test `SampleTest` that takes body of existing test `ParentTest` and adds to it the body of `SampleTest`.
9-
* An action group starting with `<actionGroup name="SampleActionGroup" extends="ParentActionGroup">` creates an action group based on the `ParentActionGroup`, but with the changes specified in `SampleActionGroup`.
10-
* An entity starting with `<entity name="SampleEntity" extends="ParentEntity">` creates an entity `SampleEntity` that is equivalent to merging the `SampleEntity` with the `ParentEntity`.
8+
* A test starting with `<test name="SampleTest" extends="ParentTest">` creates a test `SampleTest` that takes body of existing test `ParentTest` and adds to it the body of `SampleTest`.
9+
* An action group starting with `<actionGroup name="SampleActionGroup" extends="ParentActionGroup">` creates an action group based on the `ParentActionGroup`, but with the changes specified in `SampleActionGroup`.
10+
* An entity starting with `<entity name="SampleEntity" extends="ParentEntity">` creates an entity `SampleEntity` that is equivalent to merging the `SampleEntity` with the `ParentEntity`.
1111

1212
Specify needed variations for a parent object and produce a copy of the original that incorporates the specified changes (the "delta").
1313

@@ -71,8 +71,8 @@ __Use case__: Create two similar tests with different `url` (`"{{AdminCategoryPa
7171

7272
__Use case__: Create two similar tests where the second test contains two additional steps:
7373

74-
* `checkOption` before `click` (`stepKey="clickLogin"`)
75-
* `seeInCurrentUrl` after `click` in the `LogInAsAdminTest` test (in the `.../Backend/Test/LogInAsAdminTest.xml` file)
74+
* `checkOption` before `click` (`stepKey="clickLogin"`)
75+
* `seeInCurrentUrl` after `click` in the `LogInAsAdminTest` test (in the `.../Backend/Test/LogInAsAdminTest.xml` file)
7676

7777
> Tests with "extends":
7878
@@ -119,8 +119,8 @@ __Use case__: Create two similar tests where the second test contains two additi
119119

120120
__Use case__: Create two similar tests where the second one contains two additional actions in the `before` hook:
121121

122-
* `checkOption` before `click` (`stepKey="clickLogin"`)
123-
* `seeInCurrentUrl` after `click` in the `LogInAsAdminTest` test (in the `.../Backend/Test/LogInAsAdminTest.xml` file)
122+
* `checkOption` before `click` (`stepKey="clickLogin"`)
123+
* `seeInCurrentUrl` after `click` in the `LogInAsAdminTest` test (in the `.../Backend/Test/LogInAsAdminTest.xml` file)
124124

125125
> Tests with "extends":
126126
@@ -366,4 +366,4 @@ __Use case__: Create an entity named `DivPanelGreen`, which is similar to the `D
366366
[test]: ./test.md
367367
[data]: ./data.md
368368
[action group]: ./test/action-groups.md
369-
[actions]: ./test/actions.md
369+
[actions]: ./test/actions.md

docs/getting-started.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ The latest Magento 2.2 release supports MFTF 2.3.8.
1010

1111
Make sure that you have the following software installed and configured on your development environment:
1212

13-
- [PHP version supported by the Magento instance under test][php]
14-
- [Composer 1.3 or later][composer]
15-
- [Java 1.8 or later][java]
16-
- [Selenium Server Standalone 3.1 or later][selenium server] and [ChromeDriver 2.33 or later][chrome driver] or other webdriver in the same directory
13+
- [PHP version supported by the Magento instance under test][php]
14+
- [Composer 1.3 or later][composer]
15+
- [Java 1.8 or later][java]
16+
- [Selenium Server Standalone 3.1 or later][selenium server] and [ChromeDriver 2.33 or later][chrome driver] or other webdriver in the same directory
1717

1818
<div class="bs-callout bs-callout-tip" markdown="1">
1919
[PhpStorm] supports [Codeception test execution][], which is helpful when debugging.
@@ -147,16 +147,16 @@ vim dev/tests/acceptance/.env
147147

148148
Specify the following parameters, which are required to launch tests:
149149

150-
- `MAGENTO_BASE_URL` must contain a domain name of the Magento instance that will be tested.
150+
- `MAGENTO_BASE_URL` must contain a domain name of the Magento instance that will be tested.
151151
Example: `MAGENTO_BASE_URL=http://magento.test`
152152

153-
- `MAGENTO_BACKEND_NAME` must contain the relative path for the Admin area.
153+
- `MAGENTO_BACKEND_NAME` must contain the relative path for the Admin area.
154154
Example: `MAGENTO_BACKEND_NAME=admin`
155155

156-
- `MAGENTO_ADMIN_USERNAME` must contain the username required for authorization in the Admin area.
156+
- `MAGENTO_ADMIN_USERNAME` must contain the username required for authorization in the Admin area.
157157
Example: `MAGENTO_ADMIN_USERNAME=admin`
158158

159-
- `MAGENTO_ADMIN_PASSWORD` must contain the user password required for authorization in the Admin area.
159+
- `MAGENTO_ADMIN_PASSWORD` must contain the user password required for authorization in the Admin area.
160160
Example: `MAGENTO_ADMIN_PASSWORD=123123q`
161161

162162
<div class="bs-callout bs-callout-info" markdown="1">
@@ -222,8 +222,8 @@ During testing, the MFTF generates test reports in CLI.
222222
You can generate visual representations of the report data using [Allure Framework][].
223223
To view the reports in GUI:
224224

225-
- [Install Allure][]
226-
- Run the tool to serve the artifacts in `dev/tests/acceptance/tests/_output/allure-results/`:
225+
- [Install Allure][]
226+
- Run the tool to serve the artifacts in `dev/tests/acceptance/tests/_output/allure-results/`:
227227

228228
```bash
229229
allure serve dev/tests/acceptance/tests/_output/allure-results/
-2.77 KB
Loading

docs/img/issue.png

-2.35 KB
Loading

docs/img/mftf-fork.gif

-32.8 KB
Loading

docs/img/pull-request.png

-1.32 KB
Loading

docs/img/switching-the-base.png

-1.24 KB
Loading

docs/img/trouble-chrome232.png

-3.72 KB
Loading

docs/introduction.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
The Magento Functional Testing Framework (MFTF) aims to replace the [Functional Testing Framework] in future releases.
66
MFTF improves:
77

8-
- **Traceability** for clear logging and reporting capabilities.
9-
- **Modularity** to run tests based on installed modules and extensions.
10-
- **Customizability** for existing tests.
11-
- **Readability** using clear and declarative XML test steps.
12-
- **Maintainability** based on simple test creation and overall structure.
8+
- **Traceability** for clear logging and reporting capabilities.
9+
- **Modularity** to run tests based on installed modules and extensions.
10+
- **Customizability** for existing tests.
11+
- **Readability** using clear and declarative XML test steps.
12+
- **Maintainability** based on simple test creation and overall structure.
1313

1414
Because MFTF tests are written in XML, you no longer need to learn PHP to write tests.
1515

@@ -27,17 +27,17 @@ This MFTF guide is intended for Magento developers and software engineers, such
2727

2828
The purpose of MFTF is to:
2929

30-
- Facilitate functional testing and minimize the effort it takes to perform regression testing.
31-
- Make it easier to support the extension and customization of tests via XML merging.
30+
- Facilitate functional testing and minimize the effort it takes to perform regression testing.
31+
- Make it easier to support the extension and customization of tests via XML merging.
3232

3333
## Scope
3434

3535
MFTF will enable you to:
3636

37-
- Test user interactions with web applications in testing.
38-
- Write functional tests located in `<magento_root>/app/code/<vendor_name>/<module_name>/Test/Mftf/`.
39-
- Cover basic functionality using out-of-the-box tests. You can test extended functionality using custom tests.
40-
- Automate regression testing.
37+
- Test user interactions with web applications in testing.
38+
- Write functional tests located in `<magento_root>/app/code/<vendor_name>/<module_name>/Test/Mftf/`.
39+
- Cover basic functionality using out-of-the-box tests. You can test extended functionality using custom tests.
40+
- Automate regression testing.
4141

4242
## Use cases
4343

@@ -49,8 +49,8 @@ As a software engineer, perform regression testing before release to ensure that
4949

5050
There are two options to find out your MFTF version:
5151

52-
- using the MFTF CLI
53-
- using the Composer CLI
52+
- using the MFTF CLI
53+
- using the Composer CLI
5454

5555
### MFTF CLI
5656

@@ -91,18 +91,18 @@ codeception.dist.yml // Codeception configuration (generated while ru
9191

9292
## MFTF output
9393

94-
- Generated PHP Codeception tests
95-
- Codeception results and console logs
96-
- Screenshots and HTML failure report
97-
- Allure formatted XML results
98-
- Allure report dashboard of results
94+
- Generated PHP Codeception tests
95+
- Codeception results and console logs
96+
- Screenshots and HTML failure report
97+
- Allure formatted XML results
98+
- Allure report dashboard of results
9999

100100
## MFTF tests
101101

102102
The MFTF supports two different locations for storing the tests and test artifacts:
103103

104-
- `<magento_root>/app/code/<vendor_name>/<module_name>/Test/Mftf/` is the directory to create new tests.
105-
- `<magento_root>/vendor/<vendor_name>/<module_name>/Test/Mftf/` is the directory with the out of the box tests (fetched by the Composer).
104+
- `<magento_root>/app/code/<vendor_name>/<module_name>/Test/Mftf/` is the directory to create new tests.
105+
- `<magento_root>/vendor/<vendor_name>/<module_name>/Test/Mftf/` is the directory with the out of the box tests (fetched by the Composer).
106106

107107
All tests and test data from these locations are merged in the order indicated in the above list.
108108

@@ -133,4 +133,4 @@ Follow the [MFTF project] and [contribute on Github].
133133
[Functional Testing Framework]: https://devdocs.magento.com/guides/v2.3/mtf/mtf_introduction.html
134134
[MFTF project]: https://github.com/magento/magento2-functional-testing-framework
135135
[Find your MFTF version]: #find-your-mftf-version
136-
[MFTF Test Migration]: https://github.com/magento/magento-functional-tests-migration
136+
[MFTF Test Migration]: https://github.com/magento/magento-functional-tests-migration

docs/merging.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
The MFTF allows you to merge test components defined in XML files, such as:
44

5-
- [`<tests>`][]
6-
- [`<pages>`][]
7-
- [`<sections>`][]
8-
- [`<data>`][]
9-
- `<action groups>`
5+
- [`<tests>`][]
6+
- [`<pages>`][]
7+
- [`<sections>`][]
8+
- [`<data>`][]
9+
- `<action groups>`
1010

1111
You can create, delete, or update the component.
1212
It is useful for supporting rapid test creation for extensions and customizations.
@@ -18,11 +18,11 @@ Your update (XML node with changes) must have the same attribute `name` as its b
1818

1919
For example:
2020

21-
- All tests with `<test name="SampleTest>` will be merged into one.
22-
- All pages with `<page name="SamplePage>` will be merged into one.
23-
- All sections with `<section name="SampleAction">` will be merged into one.
24-
- All data entities with `<entity name="sampleData" type="sample">` will be merged into one.
25-
- All action groups with `<actionGroup name="selectNotLoggedInCustomerGroup">` will be merged into one.
21+
- All tests with `<test name="SampleTest>` will be merged into one.
22+
- All pages with `<page name="SamplePage>` will be merged into one.
23+
- All sections with `<section name="SampleAction">` will be merged into one.
24+
- All data entities with `<entity name="sampleData" type="sample">` will be merged into one.
25+
- All action groups with `<actionGroup name="selectNotLoggedInCustomerGroup">` will be merged into one.
2626

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.

0 commit comments

Comments
 (0)