diff --git a/apps/basic/tests/README.md b/apps/basic/tests/README.md index 117ab5b..5ff2669 100644 --- a/apps/basic/tests/README.md +++ b/apps/basic/tests/README.md @@ -11,6 +11,13 @@ To run the tests, follow these steps: - `functional.suite.yml` for [functional testing](http://codeception.com/docs/05-FunctionalTests) and `unit.suite.yml` for [unit testing](http://codeception.com/docs/06-UnitTests) should already work out of the box and should not need to be adjusted. + - If you want to run acceptance tests, you need to download [selenium standalone](http://www.seleniumhq.org/download/) + and start it with command `java -jar {selenium-standalone-name}.jar`. + After that you can use `WebDriver` codeception module that will connect to selenium and launch browser. + This also allows you to use [Xvfb](https://en.wikipedia.org/wiki/Xvfb) in your tests which allows you to run tests + without showing the running browser on the screen. There is codeception [blog post](http://codeception.com/05-24-2013/jenkins-ci-practice.html) + that explains how it works. + 3. Go to the application base directory and build the test suites: ``` php codecept.phar build // rebuild test scripts, only need to be run once diff --git a/extensions/yii/codeception/README.md b/extensions/yii/codeception/README.md index 9550387..6df55e3 100644 --- a/extensions/yii/codeception/README.md +++ b/extensions/yii/codeception/README.md @@ -1,33 +1,78 @@ Codeception Extension for Yii 2 =============================== -This extension provides a `Codeception` mail solution for Yii 2. It includes some classes that are useful -for unit-testing (```TestCase```) or for codeception page-objects (```BasePage```). +This extension provides [Codeception](http://codeception.com/) integration for the Yii Framework 2.0. -When using codeception page-objects they have some similar code, this code was extracted and put into the ```BasePage``` -class to reduce code duplication. Simply extend your page object from this class, like it is done in ```yii2-basic``` and -```yii2-advanced``` boilerplates. +It provides classes that help with testing with codeception: -For unit testing there is a ```TestCase``` class which holds some common features like application creation before each test -and application destroy after each test. You can configure your application by this class. ```TestCase``` is extended from ```PHPUnit_Framework_TestCase``` so all -methods and assertions are available. +- a base class for unit-tests: `yii\codeception\TestCase +- a base class for codeception page-objects: `yii\codeception\BasePage`. +- a solution for testing emails + + +Installation +------------ + +The preferred way to install this extension is through [composer](http://getcomposer.org/download/). + +Either run + +``` +php composer.phar require yiisoft/yii2-codeception "*" +``` + +or add + +```json +"yiisoft/yii2-codeception": "*" +``` + +to the require section of your composer.json. + + +Usage +----- + +When using codeception page-objects they have some similar code, this code was extracted and put into the `BasePage` +class to reduce code duplication. Simply extend your page object from this class, like it is done in `yii2-app-basic` and +`yii2-app-advanced` boilerplates. + +For unit testing there is a `TestCase` class which holds some common features like application creation before each test +and application destroy after each test. You can configure a mock application using this class. +`TestCase` is extended from `PHPUnit_Framework_TestCase` so all methods and assertions are available. ```php -SomeConsoleTest extends yii\codeception\TestCase + [ @@ -39,19 +84,19 @@ SomeOtherTest extends yii\codeception\TestCase } ``` -Because of Codeception buffers all output you cant make simple ```var_dump()``` in the TestCase, instead you need to use -```Codeception\Util\Debug::debug()``` function and then run test with ```--debug``` key, for example: +Because of Codeception buffers all output you can't make simple `var_dump()` in the TestCase, instead you need to use +`Codeception\Util\Debug::debug()` function and then run test with `--debug` key, for example: ```php +