diff --git a/docs/data.md b/docs/data.md index fa4c90dcf..834a0402a 100644 --- a/docs/data.md +++ b/docs/data.md @@ -7,6 +7,8 @@ The following diagram shows the XML structure of an MFTF data object: +The MFTF `` entities are stored in `/Test/Mftf/Data/`. + ## Supply data to test by reference to a data entity Test steps requiring `` 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: * `SimpleSubCategory` is an entity name. * `name` is a `` key of the entity. The corresponding value will be assigned to `userInput` as a result. +The following is an example of the usage of `` entity in the `Magento/Customer/Test/Mftf/Test/AdminCustomersAllCustomersNavigateMenuTest.xml` test: + +```xml + + + + +``` + +In the above example: + +* `AdminMenuCustomers` is an entity name. +* `dataUiId` is a `` key of the entity. + ### Environmental data ```xml @@ -32,6 +48,12 @@ In this example: * `MAGENTO_ADMIN_USERNAME` is a name of an environment variable. The corresponding value will be assigned to `userInput` as a result. +The following is an example of the usage of `_ENV` in the `Magento/Braintree/Test/Mftf/ActionGroup/AdminDeleteRoleActionGroup.xml` action group: + +```xml + +``` + ### Sensitive data ```xml @@ -47,6 +69,14 @@ In this example: Learn more in [Credentials][]. +The following is an example of the usage of `_CREDS` in the `Magento/Braintree/Test/Mftf/Data/BraintreeData.xml` data entity: + +```xml + + {{_CREDS.magento/braintree_enabled_fraud_merchant_id}} + +``` + ## Persist a data entity as a prerequisite of a test {#persist-data} A test can specify an entity to be persisted (created in the database) so that the test actions could operate on the existing known data. @@ -63,6 +93,14 @@ In this example: * `email` is a data key of the entity. The corresponding value will be assigned to `userInput` as a result. +The following is an example of the usage of the persistant data in `Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml` test: + +```xml + + + +``` +
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.
@@ -107,7 +145,7 @@ userInput="We'll email you an order confirmation with details and tracking info. ## Format -The format of `` is: +The format of the `` entity is: ```xml @@ -135,7 +173,7 @@ The following conventions apply to MFTF ``: ## Example -Example (`.../Catalog/Data/CategoryData.xml` file): +Example (`Magento/Catalog/Test/Mftf/Data/CategoryData.xml` file): ```xml @@ -205,7 +243,7 @@ You can also call data from the xml definition of a `data` tag directly: Attributes|Type|Use|Description ---|---|---|--- -`name`|string|optional|Name of the ``. +`name`|string|optional|Name of the ``. Use camel case for entity names. `type`|string|optional|Node containing the exact name of `` type. Used later to find specific Persistence Layer Model class. `type` in `` 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 ``, will try to find a metadata entry with the following attributes: ``. `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. @@ -220,6 +258,12 @@ Attributes|Type|Use|Description `key`|string|optional|Key attribute of data/value pair. `unique`|enum: `"prefix"`, `"suffix"`|optional|Add suite or test wide unique sequence as "prefix" or "suffix" to the data value if specified. +Example: + +```xml +simpleCategory +``` + ### var {#var-tag} `` is an element that can be used to grab a key value from another entity. For example, when creating a customer with the `` action, the server responds with the auto-incremented ID of that customer. Use `` to access that ID and use it in another data entity. @@ -231,6 +275,12 @@ Attributes|Type|Use|Description `entityKey`|string|optional|Key attribute of the referenced entity from which to get a value. `unique`|--|--|*This attribute hasn't been implemented yet.* +Example: + +```xml + +``` + ### requiredEntity {#requiredentity-tag} `` is an element that specifies the parent/child relationship between complex types.