codeception/codeception
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
behat/gherkin | v4.9.0 | 73.76 kB | MIT | prod | |
codeception/lib-asserts | 2.1.0 | 7.67 kB | MIT | prod | |
codeception/stub | 4.1.3 | 20.46 kB | MIT | prod | |
phpunit/php-code-coverage | 11.0.3 | - | BSD-3-Clause | prod | |
phpunit/php-text-template | 4.0.0 | 7.38 kB | BSD-3-Clause | prod | |
phpunit/php-timer | 7.0.0 | - | BSD-3-Clause | prod | |
phpunit/phpunit | 11.1.3 | - | BSD-3-Clause | prod dev | |
psy/psysh | v0.12.3 | 334.24 kB | MIT | prod | |
sebastian/comparator | 6.0.0 | 19.57 kB | BSD-3-Clause | prod | |
sebastian/diff | 6.0.1 | - | BSD-3-Clause | prod | |
symfony/console | v7.0.7 | - | MIT | prod dev | |
symfony/css-selector | v7.0.7 | - | MIT | prod | |
symfony/event-dispatcher | v7.0.7 | - | MIT | prod dev | |
symfony/finder | v7.0.7 | - | MIT | prod | |
symfony/var-dumper | v7.0.7 | - | MIT | prod dev | |
symfony/yaml | v7.0.7 | - | MIT | prod |
Codeception is a full-stack testing framework for PHP. Influenced by Behavior-Driven Development (BDD), it offers a unique approach to writing various types of tests, including acceptance, functional, and unit tests. Codeception is designed to describe what is being tested and how it is being tested, enabling developers to write test descriptions efficiently using PHP. The results of those tests are easily observable, indicating what actions were taken and their outcomes.
Using Codeception is straightforward. To get started, you must first install the package using Composer as follows:
php composer.phar require "codeception/codeception"
The libraries required for specific features of Codeception must also be installed. For instance, to use the PhpBrowser module:
php composer.phar require "codeception/module-phpbrowser"
Once installed, Codeception can be incorporated into your project via its Phar file, which can be downloaded from the official Codeception website. Here's how you can make Codeception executable and move it into your $PATH
:
wget https://codeception.com/codecept.phar
chmod +x codecept.phar
sudo mv codecept.phar /usr/local/bin/codecept
After that, you can initialize default settings and suites with:
codecept bootstrap
An example of how you may write a test using Codeception is:
$I->amOnPage('/');
$I->click('Pages');
$I->click('New');
$I->see('New Page');
$I->submitForm('form#new_page', ['title' => 'Movie Review']);
$I->see('page created'); // notice generated
$I->see('Movie Review','h1'); // head of page of is our title
$I->seeInCurrentUrl('pages/movie-review'); // slug is generated
$I->seeInDatabase('pages', ['title' => 'Movie Review']); // data is stored in database
You can find comprehensive Codeception documentation at https://codeception.com/docs/Introduction. Additionally, the documentation source files are available in the repository https://github.com/Codeception/codeception.github.com/tree/master/docs/. Through these resources, users can dive into a more detailed understanding of how Codeception functions, its use cases, and how to effectively implement it in their projects.