composer require "codeception/codeception" --dev
Execute:
php vendor/bin/codecept bootstrap
This creates the global configuration file codeception.yml, the tests/ directory, and the default test suites.
Generate your first acceptance test. Acceptance tests emulate the behavior
of a real user visiting your site.
Acceptance Testing Guide »
php vendor/bin/codecept generate:cest Acceptance First
It's now time to write your first test. Edit the file we've just created tests/Acceptance/FirstCest.php
It will check if your frontpage contains the word Home.
Please make sure your local development server is running. Put application URL into: tests/Acceptance.suite.yml
actor: AcceptanceTester
modules:
enabled:
- PhpBrowser:
url: {YOUR APP'S URL}
Tests are executed with 'run' command
php vendor/bin/codecept run --steps
This will execute our test with PhpBrowser. It's PHP script that can check HTML page contents, click links, fill forms, and submit POST and GET requests. For tests that require a real browser (e.g. JavaScript) use the WebDriver module.
Instead of the bootstrap
command, you can set up just a single test suite.
php vendor/bin/codecept init Acceptance
php vendor/bin/codecept init Api
php vendor/bin/codecept init Unit
Read Codeception Guides to learn how to use it.