Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit e6a4fe4

Browse files
authored
Merge branch 'master' into update-params-url
2 parents cd2e18d + 5753ff6 commit e6a4fe4

File tree

3 files changed

+188
-14
lines changed

3 files changed

+188
-14
lines changed

_data/toc/graphql.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,6 @@ pages:
7979

8080
- label: urlResolver endpoint
8181
url: /graphql/reference/url-resolver.html
82+
83+
- label: Wishlist endpoint
84+
url: /graphql/reference/wishlist.html

guides/v2.2/test/testing.md

Lines changed: 85 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,101 @@ title: Magento Testing Guide
44
landing-page: Testing Guide
55
---
66

7-
When talking about testing in Magento 2, we have to distinguish between different test types.
7+
Magento actively leverages various testing strategies to ensure product and code quality.
8+
9+
Product quality matters to the end-users working with the Magento storefront, admin panel, web APIs and CLI.
10+
Product quality tests verify that the user gets expected results while interacting with the Magento system.
11+
12+
Code quality is important to developers working with Magento codebase including:
13+
14+
- System integrators
15+
- Extension developers
16+
- Magento core team
17+
- Community contributors
18+
19+
Code quality matters for:
20+
21+
- Extensibility - It should be straightforward to extend or modify existing behavior.
22+
Good extensibility allows for:
23+
- Customizations and extensions using modularity of the platform.
24+
- Evolution of the platform with new releases.
25+
- Maintainability - It should be straightforward for developers to work within the Magento system.
26+
It can be improved with:
27+
- Complexity management - Reduce the learning curve and risk of adding new bugs.
28+
- Automatic bug detection - Reduces total cost of ownership.
29+
- Coding standards - Ensures consistency and readability.
30+
31+
Automated tests are required by [Magento definition of done][] for any code changes.
32+
33+
## Product Quality Tests
34+
35+
- [Magento Functional Testing Framework][] - Tests the storefront and admin panel UI.
36+
- [Web API Functional][] - Tests the REST, SOAP, and GraphQL areas.
37+
- [Integration][] - Ensures that all the parts work together seamlessly.
38+
- Performance - Tracks changes in CPU, Memory and other metrics. Executed nightly for develop branches. Custom builds can be configured using [performance toolkit][].
39+
- Client-side performance - Measures total page load times in the browser.
40+
- Load - Tracks the trends of system behavior under the load. Executed internally for each release using scenarios defined in the [performance toolkit][]
41+
- Upgrade - Ensures that a seamless upgrade is possible from previously released product versions to the new one. Executed internally for each release.
42+
- [JavaScript][] - Tests JS modules and other JS portions of the UI. These tests are similar to integration tests used for server-side testing.
43+
44+
## Code Quality Tests
45+
46+
- Static
47+
- [PhpCs][] - Warns developers about coding standard violations. It can be integrated into an IDE to analyze the code as soon as you write it.
48+
- [PhpMd][] - Used for monitoring code complexity and potential bugs. Can be integrated with an IDE for instant feedback.
49+
- Dependency - Prevents incorrect dependencies between modules.
50+
- Legacy code - Prevents usage of the legacy functionality.
51+
- Unit - Used for testing of isolated algorithms or discreet pieces of code.
52+
- Extensibility - Ensures the system is extensible as designed. Extensibility tests can be written using [Integration][], [JavaScript][] and [Web API Functional][] testing frameworks.
53+
- Backward-compatibility - Enforces [Magento backward compatibility policy][] at all levels including source code, database, message queue, and web API.
854

955
## Functional
1056

1157
Functional tests are mainly used for system tests at a very high level by remote controlling a browser. Magento is treated as a black box, and tests happen from a user perspective.
1258

13-
For more information, see the [Functional Testing Framework Guide]({{ page.baseurl }}/mtf/mtf_introduction.html){:target="_blank"}.
59+
The [Magento Functional Testing Framework][] (MFTF) is the main way to do functional testing. It uses XML files to run browser testing.
1460

15-
{: .bs-callout .bs-callout-info }
16-
We've released the new Magento Functional Testing Framework (MFTF) recently. [Check it out]({{ site.baseurl }}/mftf/2.2/introduction.html){:target="_blank"}.
61+
The [Functional Testing Framework][] (FTF) is the original framework used for testing Magento. This uses PHP scripts to run browser testing.
62+
This framework is no longer in development and all FTF tests are in the process of being [ported over][] to the MFTF.
63+
Until the porting to MFTF is finished, the FTF can still be run to ensure complete functional testing coverage.
1764

18-
## API Functional
65+
## API Functional
1966

2067
The Web {% glossarytooltip 786086f2-622b-4007-97fe-2c19e5283035 %}API{% endglossarytooltip %} testing framework enables you to test the Magento {% glossarytooltip 377dc0a3-b8a7-4dfa-808e-2de37e4c0029 %}Web API{% endglossarytooltip %} from the client application point of view.
2168

22-
For more information, see the [Web API functional testing]({{ page.baseurl }}/get-started/web-api-functional-testing.html){:target="_blank"}.
69+
For more information, see the [Web API functional testing][].
2370

2471
## Integration
2572

2673
Integration tests run Magento {% glossarytooltip bf703ab1-ca4b-48f9-b2b7-16a81fd46e02 %}PHP{% endglossarytooltip %} code in varying degrees of isolation. They tend to be a lot more low-level then functional tests. Because they do not utilize a browser to execute the tests, they can be a lot more granular in what they test. They also tend to run a lot quicker then functional tests.
2774

28-
For more information, see [Running Integration Tests]({{ page.baseurl }}/test/integration/integration_test_execution.html){:target="_blank"}.
75+
For more information, see [Running Integration Tests][].
2976

3077
## JavaScript
3178

3279
Much of the functionality in Magento 2 is provided with the help of sophisticated {% glossarytooltip 312b4baf-15f7-4968-944e-c814d53de218 %}JavaScript{% endglossarytooltip %}. JavaScript tests ensure the {% glossarytooltip b00459e5-a793-44dd-98d5-852ab33fc344 %}frontend{% endglossarytooltip %} portion of Magento functions as expected.
3380

34-
For more information, please see the [Extension Developer Guide on JavaScript Tests]({{ page.baseurl }}/test/js/test_js-unit.html){:target="_blank"}.
81+
For more information, please see the [Extension Developer Guide on JavaScript Tests][].
3582

3683
## Static
3784

38-
Static code analysis checks that PHP code follows the Magento 2 coding standards and best practices. They usually are executed during continuous integration using the `bin/magento` tool.
85+
Static code analysis checks that PHP code follows the Magento 2 coding standards and best practices.
86+
They are executed during continuous integration using the `bin/magento` tool.
3987

40-
Please see the [`magento dev:tests:run`]({{ page.baseurl }}/config-guide/cli/config-cli-subcommands-test.html){:target="_blank"} documentation for more information, using the test type `static`.
88+
Please see the [`magento dev:tests:run`][] documentation for more information, using the test type `static`.
4189

4290
## Unit
4391

44-
Unit tests are used to check a single unit of PHP code in isolation. They are usually written during development using [test-driven development](https://en.wikipedia.org/wiki/Test-driven_development){:target="_blank"} (TDD).
92+
Unit tests are used to check a single unit of PHP code in isolation. They are usually written during development using [test-driven development][] (TDD).
4593

4694
Because they do not require the full Magento application stack to be initialized, they run an order of magnitude faster then integration tests.
4795

48-
For more information, see [Running Unit Tests]({{ page.baseurl }}/test/unit/unit_test_execution.html){:target="_blank"}.
96+
For more information, see [Running Unit Tests][].
4997

50-
Please refer to the article [Writing testable code]({{ page.baseurl }}/test/unit/writing_testable_code.html){:target="_blank"} for more information on what to keep in mind when starting with TDD.
98+
Please refer to the article [Writing testable code][] for more information on what to keep in mind when starting with TDD.
5199

52-
The `bin/magento` tool provides a common entry point to execute any of the tests, which can be useful for continuous integration. Please see the [System Administrators Guide on Running Tests]({{ page.baseurl }}/config-guide/cli/config-cli-subcommands-test.html){:target="_blank"} for more information.
100+
The `bin/magento` tool provides a common entry point to execute any of the tests, which can be useful for continuous integration.
101+
Please see the [System Administrators Guide on Running Tests][] for more information.
53102

54103
## Where to find the tests in the file system
55104

@@ -65,3 +114,25 @@ Each of the test types listed above corresponds to a subdirectory in `<magento2
65114
└── unit
66115

67116
Each one of these test types has different requirements that must be satisfied before they can be executed.
117+
118+
<!-- Link Definitions -->
119+
[Magento definition of done]: https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing_dod.html
120+
[Functional]: https://devdocs.magento.com/guides/v2.3/mtf/mtf_introduction.html
121+
[Web API Functional]: https://devdocs.magento.com/guides/v2.3/get-started/web-api-functional-testing.html
122+
[Integration]: https://devdocs.magento.com/guides/v2.3/test/integration/integration_test_execution.html
123+
[performance toolkit]: https://devdocs.magento.com/guides/v2.3/config-guide/cli/config-cli-subcommands-perf-data.html
124+
[JavaScript]: https://devdocs.magento.com/guides/v2.3/test/js/test_js-unit.html
125+
[PhpCs]: https://devdocs.magento.com/guides/v2.3/coding-standards/code-standard-sniffers.html
126+
[PhpMd]: https://phpmd.org/
127+
[Magento backward compatibility policy]: https://devdocs.magento.com/guides/v2.3/contributor-guide/backward-compatible-development/
128+
[Functional Testing Framework]: {{ page.baseurl }}/mtf/mtf_introduction.html
129+
[Magento Functional Testing Framework]: {{ site.baseurl }}/mftf/2.2/introduction.html
130+
[Web API functional testing]: {{ page.baseurl }}/get-started/web-api-functional-testing.html
131+
[Running Integration Tests]: {{ page.baseurl }}/test/integration/integration_test_execution.html
132+
[Extension Developer Guide on JavaScript Tests]: {{ page.baseurl }}/test/js/test_js-unit.html
133+
[`magento dev:tests:run`]: {{ page.baseurl }}/config-guide/cli/config-cli-subcommands-test.html
134+
[test-driven development]: https://en.wikipedia.org/wiki/Test-driven_development
135+
[Running Unit Tests]: {{ page.baseurl }}/test/unit/unit_test_execution.html
136+
[Writing testable code]: {{ page.baseurl }}/test/unit/writing_testable_code.html
137+
[System Administrators Guide on Running Tests]: {{ page.baseurl }}/config-guide/cli/config-cli-subcommands-test.html
138+
[ported over]: https://github.com/magento/magento-functional-tests-migration
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
group: graphql
3+
title: Wishlist endpoint
4+
---
5+
6+
The Wishlist endpoint defines the contents of a customer's wish list.
7+
8+
## Query
9+
Use Wishlist queries to retrieve information about a customer's wish list.
10+
11+
### Wish list attributes
12+
13+
Attribute | Data type | Description
14+
--- | --- | ---
15+
`items` | [Wishlistitem](#wishlistitem) | An array of items in the customer's wish list
16+
`items_count` | Int | The number of items in the wish list
17+
`name` | String | When multiple wish lists are enabled, the name the customer assigns to the wish list
18+
`sharing_code` | String | An encrypted code that Magento uses to link to the wish list
19+
`updated_at` | String | The time of the last modification to the wish list
20+
21+
### Wish list item attributes {#wishlistitem}
22+
23+
Attribute | Data type | Description
24+
--- | --- | ---
25+
`added_at` | String | The time when the customer added the item to the wish list
26+
`description` | String | The customer's comment about this item
27+
`id` | Int | The wish list item ID
28+
`product` | <a href="{{ page.baseurl }}/graphql/reference/products.html#ProductInterface">ProductInterface</a> | The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes
29+
`qty` | Float | The quantity of this wish list item
30+
31+
## Syntax
32+
33+
`wishlist: WishlistOutput`
34+
35+
## Example usage
36+
37+
The following query returns the customer's wish list:
38+
39+
**Request**
40+
41+
```
42+
{
43+
wishlist {
44+
items_count
45+
name
46+
sharing_code
47+
updated_at
48+
items {
49+
id
50+
qty
51+
description
52+
added_at
53+
product {
54+
sku
55+
name
56+
}
57+
}
58+
}
59+
}
60+
```
61+
62+
**Response**
63+
64+
```json
65+
{
66+
"data": {
67+
"wishlist": {
68+
"items_count": 2,
69+
"name": "Wish List",
70+
"sharing_code": "KAXDj0HlM7Y2s58mllsVhSJvRj4fWIZj",
71+
"updated_at": "2019-02-13 22:47:45",
72+
"items": [
73+
{
74+
"id": 1,
75+
"qty": 1,
76+
"description": "My first priority",
77+
"added_at": "2019-02-20 14:38:02",
78+
"product": {
79+
"sku": "MJ09",
80+
"name": "Taurus Elements Shell"
81+
}
82+
},
83+
{
84+
"id": 2,
85+
"qty": 1,
86+
"description": null,
87+
"added_at": "2019-02-20 14:38:28",
88+
"product": {
89+
"sku": "MSH11",
90+
"name": "Arcadio Gym Short"
91+
}
92+
}
93+
]
94+
}
95+
}
96+
}
97+
```
98+
## Mutations
99+
100+
Wish list mutations will be added in a future release.

0 commit comments

Comments
 (0)