Skip to content

Latest commit

 

History

History
193 lines (139 loc) · 10.2 KB

configuration.md

File metadata and controls

193 lines (139 loc) · 10.2 KB
group title
functional-testing-framework-guide
Functional Testing Framework Configuration

The Functional Testing Framework configuration settings are located in two {% glossarytooltip 8c0645c5-aa6b-4a52-8266-5659a8b9d079 %}XML{% endglossarytooltip %} files:

  • phpunit.xml
  • config.xml

phpunit.xml {#phpunit_xml}

The <magento2_root_dir>/dev/tests/functional/phpunit.xml contains PHPUnit configuration settings. Blocks of settings are described in PHPUnit documentation, except <php> that contains parameters described in the following table.

{% collapsible Show/hide the default phpunit.xml code %}

{% highlight xml %} {% remote_markdown https://raw.githubusercontent.com/magento/magento2/2.2/dev/tests/functional/phpunit.xml.dist %} {% endhighlight %} {% endcollapsible %}

| Parameter | Description | value | Usage | |---------- | app_frontend_url | URL to Magento storefront under test. | http://<name>.<domain>/ | [Set URL for Magento storefront under test]({{ page.baseurl }}/mtf/mtf_quickstart/mtf_quickstart_config.html#mtf_quickstart_config_phpunitxml_frontend){: target="_blank"} | | app_backend_url | URL to Magento Admin under test. | "http://<name>.<domain>/<path to Admin>/" | [Set URL for Magento Admin URL under test]({{ page.baseurl }}/mtf/mtf_quickstart/mtf_quickstart_config.html#mtf_quickstart_config_phpunitxml_backend){: target="_blank"} | | testsuite_rule | Test suite name to be run. | "<test suite name>" | [Set a test suite]({{ page.baseurl }}/mtf/features/test_suite.html#configure){: target="_blank"} | | testsuite_rule_path | Path to a test suite. | "<path to test suite>" | [Set a path to test suite]({{ page.baseurl }}/mtf/features/test_suite.html#configure){: target="_blank"} | | log_directory | Path to a directory with testing reports. | "<path to the reporting directory>" | Set a reporting directory{: target="_blank"} | | events_preset | Name of a reporting event preset. | "<event preset name>" | [Set a preset]({{ page.baseurl }}/mtf/features/reporting.html#set-preset){: target="_blank"} | | module_whitelist | List of special FTF modules which are present in functional tests but are not enabled in the Magento application. | "<names of modules>" | Make listed modules (that are not enabled in Magento) visible for the FTF. | | basedir | A directory where PHPUnit reports are stored. | "<directory for PHPUnit reports>" | | | credentials_file_path | Path to the file with credentials required by services such as payment and shipment. | "./credentials.xml.dist" | [Edit credentials.xml to work with Magento modules that require credentials]({{ page.baseurl }}/mtf/mtf_quickstart/mtf_quickstart_config.html){: target="_blank"} | | mage_mode | Magento mode ([About Magento modes]({{ page.baseurl }}/config-guide/bootstrap/magento-modes.html){: target="_blank"}). | "default", "developer", "production" | This parameter is intended to be used directly in a test. The FTF doesn't use it. [Open an example]({{ site.mage2200url }}dev/tests/functional/tests/app/Magento/PageCache/Test/TestCase/FlushAdditionalCachesTest.php) | | module_filter | Applicable for [test suites]({{ page.baseurl }}/mtf/features/test_suite.html) only. Enables you to select test cases for specific modules. [Learn more about the <module> filter in a test suite.]({{ page.baseurl }}/mtf/features/test_suite.html#scope-testsuite){: target="_blank"} | "Magento_<name_of_module>" | Use it when you don't want to modify the test suite. | | module_filter_strict | Applicable for a [tests suite]({{ page.baseurl }}/mtf/features/test_suite.html) only. It has the same effect as strict in the <module>. [Learn more about strict parameter of the <module> filter in a test suite.]({{ page.baseurl }}/mtf/features/test_suite.html#scope-testsuite){: target="_blank"} | "1", "0" | Use it when you don't want to modify the test suite. |

config.xml {#config_xml}

The FTF configuration settings are declared and specified in two places:

{% collapsible in the Framework %}

The file is located in <magento2_root_dir>dev/tests/functional/vendor/magento/mtf/etc

{% highlight xml %} {% remote_markdown https://raw.githubusercontent.com/magento/mtf/develop/etc/config.xml.dist%} {% endhighlight %}

![image]({{ site.baseurl }}/common/images/ftf/ftf_mtf-config-xsd-dia.svg)

Figure 1. - XML Schema for the <magento2_root_dir>dev/tests/functional/vendor/magento/mtf/etc/config.xml.

{%endcollapsible%}

{% collapsible in Magento functional tests %}

The file is located in <magento2_root_dir>dev/tests/functional/

{% highlight xml %} {% remote_markdown https://raw.githubusercontent.com/magento/magento2/2.2/dev/tests/functional/etc/config.xml.dist %} {% endhighlight %}

![image]({{ site.baseurl }}/common/images/ftf/ftf_config-xsd-dia.svg)

Figure 2. - XML Schema for the <magento2_root_dir>dev/tests/functional/vendor/magento/mtf/etc/config.xml.

{% endcollapsible %}

The FTF merges settings from both files with the following priority:

  • config.xml in Magento has higher priority then config.xml in the Framework
  • config.xml.dist is omitted if config.xml exists

Settings are grouped into the following blocks:

<application> {#application}

Description: Application configuration settings.

Parameter Description
<reopenBrowser> Determines that a browser is to be restarted after each test or testCase.
<backendLogin> Magento Admin username that is used during functional testing.
<backendPassword> Magento Admin password that is used during functional testing.
<appBackendUrl> Base URL of the Magento Admin. Not applicable currently.
<backendLoginUrl> Relative path to the Magento Admin login page.

<isolation> {#isolation}

[Learn about isolation management][isolation management]

Description: Settings of a script to be run during functional testing.

Parameter Description Values
<resetUrlPath> Relative path of a script to be run. The URL is opened as usual web page in a browser, so that corresponding permissions must be set to the file. <resetUrlPath>dev/tests/mtf/isolation.php</resetUrlPath>
<testSuite> When the script must be called relatively to [test suite] run. none, before, after, both
<testCase> When the script must be called relatively to [test case] run. none, before, after, both
<test> When the script must be called relatively to test run. none, before, after, both

Values description:

  • none - never run
  • before - run before the entity to which it concerns
  • after - run after the entity to which it concerns
  • both - run before and after the entity to which it concerns

<server> {#server}

Open settings declarations in Selenium repository

Description: Selenium server settings.

Parameter Description Values
name Name of an item. "selenium"
type Required Selenium setting. The FTF doesn't use it. "default"
browser A browser full name to be displayed where you needed it. The FTF doesn't use it.
browserName A browser that can be used for functional testing. android, chrome, firefox, htmlunit, internet explorer, iPhone, iPad, opera, safari
host and port Address of a Selenium Server.
seleniumServerRequestsTimeout A specified period of time to process a request.
sessionStrategy Standard Selenium Server parameter that sets a session strategy. Recommended to use "shared" only. "shared", "isolated"

<desiredCapabilities>

Learn about desiredCapabilities in Selenium official documentation.

<handler> {#handler}

Specifies priorities for different types of handlers. The lower the value, the higher the priority. The highest priority has value 0. token contains access token (used by WebAPI handlers only). [Learn more about handlers.][handler]

Parameter Description Values
<webapi> priority value of a WebAPI handler. Integer
<curl> priority value of a curl handler priority. Integer
<ui> priority value of a UI handler priority. Integer

<install> {#install}

Set of parameters to be used for [installation test case].

Parameter Description
<host> Magento database hostname or IP address.
<user> Magento database username.
<password> Magento database user password.
<dbName> Name of a database.
<baseUrl> Magento application base URL, starting with the scheme (http:// or https://) and ending with a slash character (/).
<backendName> Admin URI (following the base URL).

[Learn more about installation parameters][installation parameters]

[installation test case]: {{ site.mage2200url }}dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php#L60-L77

[handler]: {{ page.baseurl }}/mtf/mtf_entities/mtf_handler.html [installation parameters]: {{ page.baseurl }}/install-gde/install/cli/install-cli-install.html#instgde-install-cli-magento [isolation management]: {{ page.baseurl }}/mtf/features/isolation.html [test case]: {{ page.baseurl }}/mtf/mtf_entities/mtf_testcase.html [test suite]: {{ page.baseurl }}/mtf/features/test_suite.html#configure

*[FTF]: Functional Testing Framework