Launch Behat tests from your browser
An application to launch your Behat tests from your browser:
To install Behat-Launcher, you will need:
- PHP 5.4
- Apache2 or Nginx or anything that can run a PHP application
- A MySQL database
- NodeJS and npm to install Bower and Grunt
1. Get the code
Go to folder where you want to install Behat-Launcher and clone the sourcecode through git command:
cd /var/www git clone firstname.lastname@example.org:alexandresalome/behat-launcher.git cd behat-launcher
2. Install dependencies
Behat-Launcher works with composer, a tool to manage dependencies.
Download it in behat-launcher folder:
cd /var/www/behat-launcher curl http://getcomposer.org/installer | php php composer.phar install
This command will download dependencies in vendor/ folder to make them available to the application.
Next you will need to install the assets using Bower and Grunt.
You can install these tools using npm, the NodeJS package manager:
npm install -g bower npm install -g grunt-cli
You can now install the assets:
bower install npm install grunt
In this folder, create a file config.php where you will configure your database and your projects.
You can use the config.php.dist file to get an exhaustive list of configuration features.
cd /var/www/behat-launcher cp config.php.dist config.php vi config.php # (or notepad, or whatever you use to edit this file)
When you're done, initialize your database:
php behat-launcher init-db
Now, configure your web server to make the application accessible through your webserver. Make it serve the web folder:
Make sure web server has write access to data/ folder.
6. Background job
To run tests, Behat-Launcher needs to run jobs in background. Start it using:
cd /var/www/behat-launcher php behat-launcher run
If you are using Linux, take a look at this gist to daemonize it.
This command will execute until you stop it. If you want command to stop after all units are ran, pass the --stop-on-finish option:
cd /var/www/behat-launcher php behat-launcher run --stop-on-finish
You're done! Access your application through web server. Given you use Apache and only have this application set up, access http://localhost
- Restart one test, all tests or failed only
- Run multiple tests concurrently
- Relaunch whole run or just failed, or stop execution
- Override behat.yml configuration values
- Record additional formats (html, failed, progress, ...)
- View output while process is running