--- layout: bootstrap title: Quick Start Codeception ---
Codeception PHP Testing Framework is designed to work just out of the box. This means its installation requires minimal steps and no external dependencies preinstalled (except PHP, of course). Only one configuration step should be taken and you are ready to test your web application from an eye of actual user.
Requirements: PHP5.3, CURL enabled
Install via Composer
$ composer require "codeception/codeception" // ./vendor/bin/codecept
$ alias codecept='./vendor/bin/codecept'
Install PHAR locally
$ wget http://codeception.com/codecept.phardownload
$ wget http://codeception.com/php54/codecept.phar // PHP 5.4 and 5.5download
$ alias codecept='codecept.phar'
Install PHAR globally
sudo curl -LsS http://codeception.com/codecept.phar -o /usr/local/bin/codecept
sudo chmod a+x /usr/local/bin/codecept
$ codecept
Execute:
codecept bootstrap
This creates codeception.yml file and tests directory.
Generate your first acceptance test. Acceptance tests emulate behavior of a real user visiting your site.
codecept generate:cept acceptance Welcome
Codeception scenario tests are called Cepts.
It's now time to write your first test. Edit the file we've just created tests/acceptance/WelcomeCept.php
It will check that your frontpage contains the word Home in it.
Please make sure your local dev serveris running. Put application URL into: tests/acceptance.suite.yml
class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser:
url: {YOUR APP'S URL}
- \Helper\Acceptance
Codeception are executed with 'run' command
codecept run
This will execute our Welcome test with PhpBrowser. It's PHP script that can check HTML page contents, click links, fill forms, and submit POST and GET requests. For more complex tests that require a browser use Selenium with WebDriver module.
Acceptance Tests (1) ------------------------------- ✓ WelcomeCept: Ensure that frontpage works Functional Tests ----------------------------------- Unit Tests ----------------------------------------- Time: 1 second, Memory: 21.00Mb OK (1 test, 1 assertions)
Follow the Acceptance Testing chapter to learn how to test your web application by clicking links, filling forms, as your regular users do.