You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/data.md
+53-3Lines changed: 53 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ The following diagram shows the XML structure of an MFTF data object:
7
7
8
8
<!-- {% raw %} -->
9
9
10
+
The MFTF `<data>` entities are stored in `<module_dir>/Test/Mftf/Data/`.
11
+
10
12
## Supply data to test by reference to a data entity
11
13
12
14
Test steps requiring `<data>` input in an action, like filling a field with a string, may reference an attribute from a data entity:
@@ -20,6 +22,20 @@ In this example:
20
22
*`SimpleSubCategory` is an entity name.
21
23
*`name` is a `<data>` key of the entity. The corresponding value will be assigned to `userInput` as a result.
22
24
25
+
The following is an example of the usage of `<data>` entity in the `Magento/Customer/Test/Mftf/Test/AdminCustomersAllCustomersNavigateMenuTest.xml` test:
As of MFTF 2.3.6, you no longer need to differentiate between scopes (a test, a hook, or a suite) for persisted data when referencing it in tests.
68
106
</div>
@@ -107,7 +145,7 @@ userInput="We'll email you an order confirmation with details and tracking info.
107
145
108
146
## Format
109
147
110
-
The format of `<data>` is:
148
+
The format of the `<data>` entity is:
111
149
112
150
```xml
113
151
<?xml version="1.0" encoding="UTF-8"?>
@@ -135,7 +173,7 @@ The following conventions apply to MFTF `<data>`:
135
173
136
174
## Example
137
175
138
-
Example (`.../Catalog/Data/CategoryData.xml` file):
176
+
Example (`Magento/Catalog/Test/Mftf/Data/CategoryData.xml` file):
139
177
140
178
```xml
141
179
<?xml version="1.0" encoding="UTF-8"?>
@@ -205,7 +243,7 @@ You can also call data from the xml definition of a `data` tag directly:
205
243
206
244
Attributes|Type|Use|Description
207
245
---|---|---|---
208
-
`name`|string|optional|Name of the `<entity>`.
246
+
`name`|string|optional|Name of the `<entity>`. Use camel case for entity names.
209
247
`type`|string|optional|Node containing the exact name of `<entity>` type. Used later to find specific Persistence Layer Model class. `type` in `<data>` can be whatever the user wants; There are no constraints. It is important when persisting data, depending on the `type` given, as it will try to match a metadata definition with the operation being done. Example: A `myCustomer` entity with `type="customer"`, calling `<createData entity="myCustomer"/>`, will try to find a metadata entry with the following attributes: `<operation dataType="customer" type="create">`.
210
248
`deprecated`|string|optional|Used to warn about the future deprecation of the data entity. String will appear in Allure reports and console output at runtime.
`<var>` is an element that can be used to grab a key value from another entity. For example, when creating a customer with the `<createData>` action, the server responds with the auto-incremented ID of that customer. Use `<var>` to access that ID and use it in another data entity.
0 commit comments