Fork me on GitHub

Installation

Requirements

  • PHP >= 5.3
  • PEAR (latest) or Composer
  • PHPUnit >= 3.6 (can be installed by Codeception)

PEAR

Easiest way to start using Codeception is by installing it via PEAR.

$ pear channel-discover codeception.com/pear
$ pear install codeception/Codeception

If you got troubles running this command, please try full package name:

$ sudo pear install codeception.github.com/pear/Codeception

If this didn't help, try to update your PEAR. Also, please, check you use the same PHP for CLI and Web.

Composer

If you got troubles using PEAR, try out Composer.

Download it in your project's dir:

curl -s http://getcomposer.org/installer | php

Create file composer.json:

{
    "require": {
        "codeception/codeception":  "*"
    },

    "repositories": {
        "behat/mink-deps": {
            "type": "composer",
            "url":  "behat.org"
        }
    }
}    

Run

php composer.phar install

From now on Codeception (with installed PHPUnit) can be run as:

php vendor/bin/codecept

Please, keep in mind that you should always specify this command instead regular 'codecept' used later in documentation.

Phar

Download codecept.phar

Copy it into your project.

From now on Codeception can be run as:

$ php codecept.phar

Please, keep in mind that you should always specify this command instead regular 'codecept' used later in documentation.

Setup

Install required libraries PHPUnit and Mink, by running this command Bypass this step if you installed Codeception via Composer.

$ codecept install

Go to project you want to test and bootstrap the test environment:

$ codecept bootstrap

Next, run the build command.

$ codecept build

At last, Codeception is ready to run the tests.

$ codecept run

Refer to Codeception Guide to write your first tests.