Magento 2 Functional Testing Framwork - for Vagrant Setup
#installation composer
cd /dev/test/functional
composer install
#In php.ini file, make sure extension=php_openssl.dll is not commented out.
#verify version in <magento2_root_dir>/dev/tests/functional/vendor/magento/mtf/CHANGELOG.md
#If you cannot find phpunit.xml, create it from phpunit.xml.dist
#set url for front & backend
#<env name="app_frontend_url" value="http://example.com/magento2/"/>
#<env name="app_backend_url" value="http://example.com/magento2/admin/"/>
#Find config.xml in <magento2_root_dir>/dev/tests/functional/etc, and open it in editor.
##for guest to host access to selenium add
<server>
<item name="selenium"
type="default"
browser="Mozilla Firefox"
browserName="firefox"
host="192.168.10.1"
port="4444"
seleniumServerRequestsTimeout="90"
sessionStrategy="shared">
<desiredCapabilities>
<platform>ANY</platform>
</desiredCapabilities>
</item>
</server>
#use chrome webdriver
<server>
<item name="selenium"
type="default"
browser="Google Chrome"
browserName="chrome"
host="192.168.10.1"
port="4444"
seleniumServerRequestsTimeout="180"
sessionStrategy="shared">
<desiredCapabilities>
<platform>ANY</platform>
</desiredCapabilities>
</item>
</server>
#run selenium server on host
java -jar <path_to_selenium_directory>/selenium-server.jar
#run selenium with chrome
java -Dwebdriver.chrome.driver=F:/xampp/selenium/chromedriver.exe -jar <path_to_selenium_directory>/selenium-server.jar
#prepare magento installation - backend config for tests
# http://devdocs.magento.com/guides/v2.2/mtf/mtf_quickstart/mtf_quickstart_magento.html
#generate test data
cd /dev/test/functional/util
php generate.php
#run all tests
vendor/bin/phpunit
#run single test
#Name of test is the name of PHP file with test
vendor/bin/phpunit --filter <name of test>
#example
#<magento2_root_dir>/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.php
vendor/bin/phpunit --filter CreateCategoryEntityTest