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
Data set contains data used by a [test case] and [constraints].
18
19
A data set can have several variations.
19
20
Each variation has constraints that are called at the end of the test flow.
@@ -362,6 +363,7 @@ To add a new variation using merging, you should simply use the name of a [test
362
363
Variations `DeleteVideoFromPCFTestVariation1` and `DeleteVideoFromPCFTestVariation2` will be used by the `Magento\Catalog\Test\TestCase\Product\UpdateSimpleProductEntityTest` class during the test run.
363
364
364
365
### Extend a variation with data {#extend_variation}
366
+
365
367
If you want to extend variation in another module using merging, you should use a [test case][] name that you want to merge with and a variation name that you want to extend.
366
368
367
369
For example, see how in `Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.xml`
@@ -375,6 +377,20 @@ For example, see how in `Magento/Catalog/Test/TestCase/Product/ValidateOrderOfPr
You can replace one variation with another by using a `replace` attribute of the `variation` node:
384
+
385
+
{%highlight xml%}
386
+
387
+
<variationname="CreateSuperNewCustomerBackendEntityTestVariation1"replace="CreateCustomerBackendEntityTestVariation1"summary="Variation that replaces default CreateCustomerBackendEntityTestVariation1">
388
+
389
+
{%endhighlight xml%}
390
+
391
+
After a merge of a data set with the variation that is mentioned, a test will use `CreateSuperNewCustomerBackendEntityTestVariation1` instead of `CreateSuperNewCustomerBackendEntityTestVariation1`.
Copy file name to clipboardExpand all lines: guides/v2.0/mtf/mtf_entities/mtf_fixture-repo.md
+74-1Lines changed: 74 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -435,9 +435,82 @@ To run the generator, enter the following command in your terminal:
435
435
436
436
The preceding is an example of repository merging. Using the approach from the example you can merge repositories for any other fixture, not `Config` only.
437
437
438
+
### Data set replacement {#dataset-replacement}
439
+
440
+
You can modify your data set without changing the name of the data set. Simply use a `replace` attribute. For example,
Later you installed a new module Magento_CustomerNew module that changed Customer fixture. You don't want to change the `default` data set name in the test. Instead, you can simply replace the `default` data set, without changing the name:
you have the following code in the Customer repository (`<magento2>/dev/tests/functional/generated/Magento/Customer/Test/Repository/Customer.php`):
495
+
496
+
{%highlight php startinline=1%}
497
+
498
+
$this->_data['default'] = [
499
+
'firstname' => 'John',
500
+
'lastname' => 'Doe',
501
+
'email' => 'JohnDoe_%isolation%@example.com',
502
+
'new_field' => 'Some value',
503
+
'password' => '123123q',
504
+
'password_confirmation' => '123123q',
505
+
];
506
+
507
+
{%endhighlight%}
508
+
509
+
As you can see, a repository with the name `default` contains data from the `customer_new_default` repository.
510
+
438
511
## Credentials and `%isolation%` in repository {#mtf_repository_credent_iso}
439
512
440
-
Credentials are stored in XML file specified in `phpunit.xml`.
513
+
Credentials are stored in an `*.xml`file that is specified in `phpunit.xml`.
441
514
442
515
You can find a template for credentials in <ahref="https://github.com/magento/magento2/blob/master/dev/tests/functional/credentials.xml.dist"><code><magento2>/dev/tests/functional/credentials.xml.dist</code></a>.
### Run tests on nondefault browser {#mtf_quickstart_env_selenium-non-def}
31
+
### Run tests on non-default browser {#mtf_quickstart_env_selenium-non-def}
32
32
33
33
If the Selenium Server does not work directly with your browser, find the corresponding [WebDriver][].
34
34
35
-
In `config.xml` <ahref="{{site.gdeurl}}mtf/mtf_quickstart/mtf_quickstart_config.html#mtf_quickstart_config_configxml_browser"> set browser that MTF will use for tests</a>.
35
+
In `config.xml` <ahref="{{site.gdeurl}}mtf/mtf_quickstart/mtf_quickstart_config.html#mtf_quickstart_config_configxml_browser"> define the browser that the MTF will use for tests</a>.
36
36
37
37
Run the Selenium Server with an additional argument.
Generator generates fixtures, repositories and page objects. Once MTF is initialized, all classes will be pre-generated to facilitate creating and running the tests.
47
+
Generator generates [fixtures][], [repositories][], and [page objects][]. Once the MTF is initialized, all classes must be pre-generated to facilitate creating and running the tests. Modules in the MTF are processed by generator in the same order that they are processed during Magento loading.
46
48
47
49
Enter in terminal:
48
50
@@ -52,5 +54,17 @@ Enter in terminal:
52
54
<h2id="mtf_install_pre">Next Steps</h2>
53
55
<ahref="{{ site.gdeurl }}mtf/mtf_quickstart/mtf_quickstart_config.html"><< Adjust configuration </a> | <ahref="{{ site.gdeurl }}mtf/mtf_quickstart/mtf_quickstart_runtest.html"> Test run >></a>
0 commit comments