-
Notifications
You must be signed in to change notification settings - Fork 19
Testing Lara
As of this moment, there are two types of tests in Laravel. First there are the standard Laravel tests that can be used to test the models and (partially) the views. The other tests require Selenium and Integrated to be run.
These tests run in memory and are therefor very fast. They do not emulate any browser behaviour, so they will not test javascript execution. You can find these tests under tests/integrations
and tests/unit
. You can run these tests from the Phpstorm IDE or by runing phpunit from the command line.
These tests emulate a user interacting with the browser. They use the Integrated package developed by Jeffrey Way. To run these tests you will have to install the latest version of Selenium as well as the geckodriver along with an older installation of firefox (Firefox 45). Before you start selenium make sure that the driver is in the same folder as the .jar file. Then start the server by running
$> java -jar selenium-server-standalone-*.jar
Also make sure that you have the correct composer dependencies installed.
Now you can execute the tests stored in the tests\acceptance
directory from your IDE or command line.
If at any point phpunit does not find a class you need for the tests, make sure that your composer.json has all the dependencies stored in the autoload-dev property. If you change the required files/directories for the test be sure to run
$> composer dump-autoload
before you try to execute your tests. This will update the vendor\autload.php
file.