Minimal code to get started with behat php testing using mink on windows 10
-
Java runtime for windows
-
PHP - PHP 7.3.10 was used while testing
-
Composer - download
-
Selenium Standalone server - selenium-server-standalone-2.53.0 was used while code testing because 3+ versions had some issues.
-
Download and install all the requirements mentioned above and make sure that Composer is in the path environment variable of windows.
-
Run
composer install
in the same directory as composer.json (projects root directory) to install all the dependencies. -
Run
bin\behat --init
-
Place the downloaded selenium-server-standalone-*.jar file in selenium folder.
If your selenium version is not 2.53.0 then edit the selenium.bat file accordingly
-
Double-click on selenium.bat. Now you are ready to start testing.
-
Run
bin\behat
to run your features defined in features folder.
-
I have already defined few useful functions for reference in FeatureContext.php i.e. dropping a file in dropzone, waiting for element to appear etc.
-
You can run
bin\behat -dl
orbin\behat -di
(more expressive) for the list of available definitions to use in your *.feature. -
Here is a nice post with useful compilation of tips.