From 543839658a2ffd360ec10efc873f5d615b313116 Mon Sep 17 00:00:00 2001 From: Davert Date: Sun, 1 Apr 2018 02:23:08 +0300 Subject: [PATCH] updated docs, removed mentions of Cept format --- docs/01-Introduction.md | 4 +- docs/02-GettingStarted.md | 134 ++++++++++++++----------------- docs/03-AcceptanceTests.md | 19 +++-- docs/05-UnitTests.md | 14 ++-- docs/06-ReusingTestCode.md | 7 +- docs/07-AdvancedUsage.md | 24 +++--- docs/07-BDD.md | 2 +- docs/08-Customization.md | 10 +-- docs/10-WebServices.md | 57 ++++++------- docs/12-ContinuousIntegration.md | 10 +-- 10 files changed, 137 insertions(+), 144 deletions(-) diff --git a/docs/01-Introduction.md b/docs/01-Introduction.md index ff97b24663..5d365b7d5f 100644 --- a/docs/01-Introduction.md +++ b/docs/01-Introduction.md @@ -48,7 +48,6 @@ With acceptance tests, you can be confident that users, following all the define ```php amOnPage('/'); $I->click('Sign Up'); $I->submitForm('#signup', ['username' => 'MilesDavis', 'email' => 'miles@davis.com']); @@ -72,7 +71,6 @@ Codeception provides connectors to several popular PHP frameworks. You can also ```php amOnPage('/'); $I->click('Sign Up'); $I->submitForm('#signup', ['username' => 'MilesDavis', 'email' => 'miles@davis.com']); @@ -106,7 +104,7 @@ function testSavingUser() $user->setSurname('Davis'); $user->save(); $this->assertEquals('Miles Davis', $user->getFullName()); - $this->unitTester->seeInDatabase('users', ['name' => 'Miles', 'surname' => 'Davis']); + $this->tester->seeInDatabase('users', ['name' => 'Miles', 'surname' => 'Davis']); } ``` diff --git a/docs/02-GettingStarted.md b/docs/02-GettingStarted.md index 058b13193c..bc3fb3174e 100644 --- a/docs/02-GettingStarted.md +++ b/docs/02-GettingStarted.md @@ -59,66 +59,64 @@ When you change the configuration, the actor classes are rebuilt automatically. try to generate them manually with the `build` command: ```bash -php codecept build +php vendor/bin/codecept build ``` -## Writing a Sample Scenario +## Writing a Sample Test -By default tests are written as narrative scenarios. To make a PHP file a valid scenario, its name should have a `Cept` suffix. - -Let's say we have created a file `tests/acceptance/SigninCept.php` - -We can do that by running the following command: +Codeception has its own testing format called Cest (Codecept + Test). +To start writing a test we need to create a new Cest file. We can do that by running the following command: ```bash -php codecept generate:cept acceptance Signin +php vendor/bin/codecept generate:cest acceptance Signin ``` -A scenario always starts with actor class initialization. After that, writing a scenario is just like typing `$I->` -and choosing a proper action from the auto-completion list. Let's log in to our website: +This will generate `SigninCest.php` file inside `tests/acceptance` directory. Let's open it: ```php wantTo('login to website'); - -``` - -The `wantTo` section describes your scenario in brief. There are additional comment methods that are useful to describe the context of a scenario: +class SigninCest +{ + function _before(AcceptanceTester $I) + { + } + + public function _after(AcceptanceTester $I) + { + } -```php -am('user'); // actor's role -$I->wantTo('login to website'); // feature to test -$I->lookForwardTo('access website features for logged-in users'); // result to achieve + public function tryToTest(AcceptanceTester $I) + { + // todo: write test + } +} ``` -After we have described the story background, let's start writing a scenario. +We have `_before` and `_after` methods to run some common actions before and after a test. And we have a placeholder action `tryToTest` which we need to implement. +If we try to test a signin process it's a good start to test a successful signin. Let's rename this method to `signInSuccessfully`. -We'll assume that we have a 'login' page where we get authenticated by providing a username and password. +We'll assume that we have a 'login' page where we get authenticated by providing a username and password. Then we are sent to a user page, where we see the text `Hello, %username%`. Let's look at how this scenario is written in Codeception: ```php am('user'); -$I->wantTo('login to website'); -$I->lookForwardTo('access website features for logged-in users'); -$I->amOnPage('/login'); -$I->fillField('Username','davert'); -$I->fillField('Password','qwerty'); -$I->click('Login'); -$I->see('Hello, davert'); +class SigninCest +{ + public function loginSuccessfully(AcceptanceTester $I) + { + $I->amOnPage('/login'); + $I->fillField('Username','davert'); + $I->fillField('Password','qwerty'); + $I->click('Login'); + $I->see('Hello, davert'); + } +} ``` This scenario can probably be read by non-technical people. If you just remove all special chars like braces, arrows and `$`, this test transforms into plain English text: ``` -I am user -I wantTo login to website -I lookForwardTo access website features for logged-in users I amOnPage '/login' I fillField 'Username','davert' I fillField 'Password','qwerty' @@ -129,7 +127,7 @@ I see 'Hello, davert' Codeception generates this text representation from PHP code by executing: ```bash -php codecept generate:scenarios +php vendor/bin/codecept generate:scenarios ``` These generated scenarios will be stored in your `_data` directory in text files. @@ -149,14 +147,14 @@ modules: After configuring the URL we can run this test with the `run` command: ```bash -php codecept run +php vendor/bin/codecept run ``` This is the output we should see: ```bash Acceptance Tests (1) ------------------------------- -✔ SigninCept: Login to website +✔ SigninCest: sign in successfully ---------------------------------------------------- Time: 1 second, Memory: 21.00Mb @@ -167,19 +165,17 @@ OK (1 test, 1 assertions) Let's get some detailed output: ```bash -php codecept run acceptance --steps +php vendor/bin/codecept run acceptance --steps ``` We should see a step-by-step report on the performed actions: ```bash Acceptance Tests (1) ------------------------------- -SigninCept: Login to website -Signature: SigninCept.php -Test: tests/acceptance/SigninCept.php +SigninCest: Login to website +Signature: SigninCest.php:signInSuccessfully +Test: tests/acceptance/SigninCest.php:signInSuccessfully Scenario -- - I am user - I look forward to access website features for logged-in users I am on page "/login" I fill field "Username" "davert" I fill field "Password" "qwerty" @@ -196,54 +192,43 @@ OK (1 test, 1 assertions) This simple test can be extended to a complete scenario of site usage, therefore, by emulating the user's actions, you can test any of your websites. -Give it a try! +To run more tests create a public method for each of them. Include `AcceptanceTester` object as `$I` as a method parameter and use the same `$I->` API you've seen before. +If your tests share common setup actions put them into `_before` method. -## Cept, Cest and Test Formats - -Codeception supports three test formats. Beside the previously described scenario-based Cept format, -Codeception can also execute [PHPUnit test files for unit testing](http://codeception.com/docs/05-UnitTests), and Cest format. - -**Cest** combines scenario-driven test approach with OOP design. In case you want to group a few testing scenarios into one, you should consider using Cest format. -In the example below we are testing CRUD actions within a single file but with several tests (one per operation): +For instance, to test CRUD we want 4 methods to be implemented and all next tests should start at `/task` page: ```php amOnPage('/'); + $I->amOnPage('/task'); } - function createPage(AcceptanceTester $I) + function createTask(AcceptanceTester $I) { // todo: write test } - function viewPage(AcceptanceTester $I) + function viewTask(AcceptanceTester $I) { // todo: write test } - function updatePage(AcceptanceTester $I) + function updateTask(AcceptanceTester $I) { // todo: write test } - function deletePage(AcceptanceTester $I) + function deleteTask(AcceptanceTester $I) { // todo: write test } } ``` -Cest files such as this can be created by running a generator: - -```bash -php codecept generate:cest acceptance PageCrud -``` - Learn more about the [Cest format](http://codeception.com/docs/07-AdvancedUsage#Cest-Classes) in the Advanced Testing section. ## BDD @@ -262,44 +247,44 @@ The same goes for suite configs. For example, the `unit.suite.yml` will be merge Tests can be started with the `run` command: ```bash -php codecept run +php vendor/bin/codecept run ``` With the first argument you can run all tests from one suite: ```bash -php codecept run acceptance +php vendor/bin/codecept run acceptance ``` To limit tests run to a single class, add a second argument. Provide a local path to the test class, from the suite directory: ```bash -php codecept run acceptance SigninCept.php +php vendor/bin/codecept run acceptance SigninCest.php ``` Alternatively you can provide the full path to test file: ```bash -php codecept run tests/acceptance/SigninCept.php +php vendor/bin/codecept run tests/acceptance/SigninCest.php ``` You can further filter which tests are run by appending a method name to the class, separated by a colon (for Cest or Test formats): ```bash -php codecept run tests/acceptance/SignInCest.php:^anonymousLogin$ +php vendor/bin/codecept run tests/acceptance/SigninCest.php:^anonymousLogin$ ``` You can provide a directory path as well. This will execute all acceptance tests from the `backend` dir: ```bash -php codecept run tests/acceptance/backend +php vendor/bin/codecept run tests/acceptance/backend ``` Using regular expressions, you can even run many different test methods from the same directory or class. For example, this will execute all acceptance tests from the `backend` dir beginning with the word "login": ```bash -php codecept run tests/acceptance/backend:^login +php vendor/bin/codecept run tests/acceptance/backend:^login ``` To execute a group of tests that are not stored in the same directory, you can organize them in [groups](http://codeception.com/docs/07-AdvancedUsage#Groups). @@ -309,7 +294,7 @@ To execute a group of tests that are not stored in the same directory, you can o To generate JUnit XML output, you can provide the `--xml` option, and `--html` for HTML report. ```bash -php codecept run --steps --xml --html +php vendor/bin/codecept run --steps --xml --html ``` This command will run all tests for all suites, displaying the steps, and building HTML and XML reports. Reports will be stored in the `tests/_output/` directory. @@ -317,7 +302,7 @@ This command will run all tests for all suites, displaying the steps, and buildi To see all the available options, run the following command: ```bash -php codecept help run +php vendor/bin/codecept help run ``` ## Debugging @@ -329,7 +314,6 @@ You may print any information inside a test using the `codecept_debug` function. There are plenty of useful Codeception commands: -* `generate:cept` *suite* *filename* - Generates a sample Cept scenario * `generate:cest` *suite* *filename* - Generates a sample Cest test * `generate:test` *suite* *filename* - Generates a sample PHPUnit Test with Codeception hooks * `generate:feature` *suite* *filename* - Generates Gherkin feature file diff --git a/docs/03-AcceptanceTests.md b/docs/03-AcceptanceTests.md index bab9320268..a091298d02 100644 --- a/docs/03-AcceptanceTests.md +++ b/docs/03-AcceptanceTests.md @@ -60,13 +60,23 @@ modules: - \Helper\Acceptance ``` -We should start by creating a 'Cept' file: +We should start by creating a test with the next command: + +``` +php vendor/bin/codecept g:cest acceptance Signin +``` + +It will be placed into `tests/acceptance` directory. ```php wantTo('sign in'); +class SigninCest +{ + public function tryToTest(AcceptanceTester $I) + { + $I->wantTo('test my page'); + } +} ``` The `$I` object is used to write all interactions. @@ -203,7 +213,6 @@ you can pass instance `\Codeception\Step\Argument\PasswordArgument` with the dat ```php amOnPage('/form/password_argument'); diff --git a/docs/05-UnitTests.md b/docs/05-UnitTests.md index 0aa9400710..60b538bab5 100644 --- a/docs/05-UnitTests.md +++ b/docs/05-UnitTests.md @@ -9,7 +9,7 @@ Codeception adds some nice helpers to simplify common tasks. Create a test using `generate:test` command with a suite and test names as parameters: ```bash -php codecept generate:test unit Example +php vendor/bin/codecept generate:test unit Example ``` It creates a new `ExampleTest` file located in the `tests/unit` directory. @@ -17,13 +17,13 @@ It creates a new `ExampleTest` file located in the `tests/unit` directory. As always, you can run the newly created test with this command: ```bash -php codecept run unit ExampleTest +php vendor/bin/codecept run unit ExampleTest ``` Or simply run the whole set of unit tests with: ```bash -php codecept run unit +php vendor/bin/codecept run unit ``` A test created by the `generate:test` command will look like this: @@ -73,15 +73,15 @@ class UserTest extends \Codeception\Test\Unit { public function testValidation() { - $user = User::create(); + $user = new User(); - $user->username = null; + $user->setName(null); $this->assertFalse($user->validate(['username'])); - $user->username = 'toolooooongnaaaaaaameeee'; + $user->setName('toolooooongnaaaaaaameeee'); $this->assertFalse($user->validate(['username'])); - $user->username = 'davert'; + $user->setName('davert'); $this->assertTrue($user->validate(['username'])); } } diff --git a/docs/06-ReusingTestCode.md b/docs/06-ReusingTestCode.md index ba076e333c..5ac61a6398 100644 --- a/docs/06-ReusingTestCode.md +++ b/docs/06-ReusingTestCode.md @@ -12,7 +12,6 @@ We will get back to this later in this chapter, but for now let's look at the fo ```php amOnPage('/'); $I->see('Hello'); $I->seeInDatabase('users', ['id' => 1]); @@ -150,14 +149,14 @@ We call such a classes StepObjects. Lets create an Admin StepObject with the generator: ```bash -php codecept generate:stepobject acceptance Admin +php vendor/bin/codecept generate:stepobject acceptance Admin ``` You can supply optional action names. Enter one at a time, followed by a newline. End with an empty line to continue to StepObject creation. ```bash -php codecept generate:stepobject acceptance Admin +php vendor/bin/codecept generate:stepobject acceptance Admin Add action to StepObject class (ENTER to exit): loginAsAdmin Add action to StepObject class (ENTER to exit): StepObject was created in /tests/acceptance/_support/Step/Acceptance/Admin.php @@ -243,7 +242,7 @@ Do not hardcode complex CSS or XPath locators in your tests but rather move them Codeception can generate a PageObject class for you with command: ```bash -php codecept generate:pageobject Login +php vendor/bin/codecept generate:pageobject Login ``` This will create a `Login` class in `tests/_support/Page`. diff --git a/docs/07-AdvancedUsage.md b/docs/07-AdvancedUsage.md index 9d8377cc41..dba333b58b 100644 --- a/docs/07-AdvancedUsage.md +++ b/docs/07-AdvancedUsage.md @@ -12,7 +12,7 @@ and you want to split it, you can easily move it into classes. You can create a Cest file by running the command: ```bash -$ php codecept generate:cest suitename CestName +$ php vendor/bin/codecept generate:cest suitename CestName ``` The generated file will look like this: @@ -387,7 +387,7 @@ The names of these files are used as environments names You can generate a new file with this environment configuration by using the `generate:environment` command: ```bash -$ php codecept g:env chrome +$ php vendor/bin/codecept g:env chrome ``` In that file you can specify just the options you wish to override: @@ -405,13 +405,13 @@ You can easily switch between those configs by running tests with `--env` option To run the tests only for PhantomJS you just need to pass `--env phantom` as an option: ```bash -$ php codecept run acceptance --env phantom +$ php vendor/bin/codecept run acceptance --env phantom ``` To run the tests in all 3 browsers, list all the environments: ```bash -$ php codecept run acceptance --env phantom --env chrome --env firefox +$ php vendor/bin/codecept run acceptance --env phantom --env chrome --env firefox ``` The tests will be executed 3 times, each time in a different browser. @@ -419,7 +419,7 @@ The tests will be executed 3 times, each time in a different browser. It's also possible to merge multiple environments into a single configuration by separating them with a comma: ```bash -$ php codecept run acceptance --env dev,phantom --env dev,chrome --env dev,firefox +$ php vendor/bin/codecept run acceptance --env dev,phantom --env dev,chrome --env dev,firefox ``` The configuration is merged in the order given. @@ -543,7 +543,7 @@ The interactive console was added to try Codeception commands before executing t You can run the console with the following command: ``` bash -$ php codecept console suitename +$ php vendor/bin/codecept console suitename ``` Now you can execute all the commands of an appropriate Actor class and see the results immediately. @@ -560,15 +560,15 @@ If you have several projects with Codeception tests, you can use a single `codec You can pass the `-c` option to any Codeception command (except `bootstrap`), to execute Codeception in another directory: ```bash -$ php codecept run -c ~/projects/ecommerce/ -$ php codecept run -c ~/projects/drupal/ -$ php codecept generate:cept acceptance CreateArticle -c ~/projects/drupal/ +$ php vendor/bin/codecept run -c ~/projects/ecommerce/ +$ php vendor/bin/codecept run -c ~/projects/drupal/ +$ php vendor/bin/codecept generate:cept acceptance CreateArticle -c ~/projects/drupal/ ``` To create a project in directory different from the current one, just provide its path as a parameter: ```bash -$ php codecept bootstrap ~/projects/drupal/ +$ php vendor/bin/codecept bootstrap ~/projects/drupal/ ``` Also, the `-c` option allows you to specify another config file to be used. @@ -580,13 +580,13 @@ and settings). Just pass the `.yml` filename as the `-c` parameter to execute te There are several ways to execute a bunch of tests. You can run tests from a specific directory: ```bash -$ php codecept run tests/acceptance/admin +$ php vendor/bin/codecept run tests/acceptance/admin ``` You can execute one (or several) specific groups of tests: ```bash -$ php codecept run -g admin -g editor +$ php vendor/bin/codecept run -g admin -g editor ``` The concept of groups was taken from PHPUnit and behave in the same way. diff --git a/docs/07-BDD.md b/docs/07-BDD.md index 1c05986f37..c4e7bfcd1a 100644 --- a/docs/07-BDD.md +++ b/docs/07-BDD.md @@ -81,7 +81,7 @@ Feature file is written in Gherkin format. Codeception can generate a feature fi We will assume that we will use scenarios in feature files for acceptance tests, so feature files to be placed in `acceptance` suite directory: ```bash -php codecept g:feature acceptance checkout +php vendor/bin/codecept g:feature acceptance checkout ``` Generated template will look like this: diff --git a/docs/08-Customization.md b/docs/08-Customization.md index dde87bfbd1..22e1d2f021 100644 --- a/docs/08-Customization.md +++ b/docs/08-Customization.md @@ -34,7 +34,7 @@ To avoid naming conflicts between Actor classes and Helper classes, they should To create test suites with namespaces you can add `--namespace` option to the bootstrap command: ```bash -php codecept bootstrap --namespace frontend +php vendor/bin/codecept bootstrap --namespace frontend ``` This will bootstrap a new project with the `namespace: frontend` parameter in the `codeception.yml` file. @@ -44,7 +44,7 @@ Once each of your applications (bundles) has its own namespace and different Hel you can execute all the tests in a single runner. Run the Codeception tests as usual, using the meta-config we created earlier: ```bash -php codecept run +php vendor/bin/codecept run ``` This will launch the test suites for all three applications and merge the reports from all of them. @@ -54,7 +54,7 @@ and you want to get a single report in JUnit and HTML format. The code coverage If you want to run a specific suite from the application you can execute: ``` -php codecept run unit -c frontend +php vendor/bin/codecept run unit -c frontend ``` Where `unit` is the name of suite and the `-c` option specifies the path to the `codeception.yml` configuration file to use. @@ -71,7 +71,7 @@ By default, one `RunFailed` Extension is already enabled in your global `codecep It allows you to rerun failed tests by using the `-g failed` option: ``` -php codecept run -g failed +php vendor/bin/codecept run -g failed ``` Codeception comes with bundled extensions located in `ext` directory. @@ -293,7 +293,7 @@ For instance, for `nocleanup` group we prevent Doctrine2 module from wrapping te } ``` -A group class can be created with `php codecept generate:group groupname` command. +A group class can be created with `php vendor/bin/codecept generate:group groupname` command. Group classes will be stored in the `tests/_support/Group` directory. A group class can be enabled just like you enable an extension class. In the file `codeception.yml`: diff --git a/docs/10-WebServices.md b/docs/10-WebServices.md index 7c5556294d..79a907bf7d 100644 --- a/docs/10-WebServices.md +++ b/docs/10-WebServices.md @@ -5,7 +5,7 @@ The same way we tested a web site, Codeception allows you to test web services. You should start by creating a new test suite, (which was not provided by the `bootstrap` command). We recommend calling it **api** and using the `ApiTester` class for it. ```bash -$ php codecept generate:suite api +$ php vendor/bin/codecept generate:suite api ``` We will put all the api tests there. @@ -51,22 +51,36 @@ modules: Once we have configured our new testing suite, we can create the first sample test: ```bash -$ php codecept generate:cept api CreateUser +$ codecept generate:cest api CreateUser ``` -It will be called `CreateUserCept.php`. We can use it to test the creation of a user via the REST API. +It will be called `CreateUserCest.php`. +We need to implement a public method for each test. Let's make `createUserViaAPI` to test creation of a user via the REST API. ```php wantTo('create a user via API'); -$I->amHttpAuthenticated('service_user', '123456'); -$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); -$I->sendPOST('/users', ['name' => 'davert', 'email' => 'davert@codeception.com']); -$I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); // 200 -$I->seeResponseIsJson(); -$I->seeResponseContains('{"result":"ok"}'); - +class CreateUserCest +{ + public function _before(\ApiTester $I) + { + } + + public function _after(\ApiTester $I) + { + } + + // tests + public function createUserViaAPI(\ApiTester $I) + { + $I->amHttpAuthenticated('service_user', '123456'); + $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); + $I->sendPOST('/users', ['name' => 'davert', 'email' => 'davert@codeception.com']); + $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); // 200 + $I->seeResponseIsJson(); + $I->seeResponseContains('{"result":"ok"}'); + + } +} ``` We can use HTTP code constants from `Codeception\Util\HttpCode` instead of numeric values to check response code in `seeResponseCodeIs` and `dontSeeResponseCodeIs` methods. @@ -117,14 +131,11 @@ If we expect a JSON response to be received we can check its structure with [JSO ```php wantTo('validate structure of GitHub api responses'); $I->sendGET('/users'); $I->seeResponseCodeIs(HttpCode::OK); // 200 $I->seeResponseIsJson(); $I->seeResponseJsonMatchesJsonPath('$[0].user.login'); $I->seeResponseJsonMatchesXpath('//user/login'); - ``` More detailed check can be applied if you need to validate the type of fields in a response. @@ -155,25 +166,21 @@ There is `seeXmlResponseIncludes` method to match inclusion of XML parts in resp ```php wantTo('validate structure of GitHub api responses'); $I->sendGET('/users.xml'); $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); // 200 $I->seeResponseIsXml(); $I->seeXmlResponseMatchesXpath('//user/login'); -$I->seeXmlResponseIncludes(XmlUtils::toXml( +$I->seeXmlResponseIncludes(\Codeception\Util\Xml::toXml([ 'user' => [ 'name' => 'davert', 'email' => 'davert@codeception.com', 'status' => 'inactive' ] -)); +])); ``` -We are using XmlUtils class which allows us to build XML structures in a clean manner. The `toXml` method may accept a string or array and returns \DOMDocument instance. If your XML contains attributes and so can't be represented as a PHP array you can create XML using the [XmlBuilder](http://codeception.com/docs/reference/XmlBuilder) class. We will take a look at it a bit more in next section. +We are using `Codeception\Util\Xml` class which allows us to build XML structures in a clean manner. The `toXml` method may accept a string or array and returns \DOMDocument instance. If your XML contains attributes and so can't be represented as a PHP array you can create XML using the [XmlBuilder](http://codeception.com/docs/reference/XmlBuilder) class. We will take a look at it a bit more in next section.
Use `\Codeception\Util\Xml::build()` to create XmlBuilder instance. @@ -247,14 +254,10 @@ In the next example we will use `XmlBuilder` instead of regular XML. ```php wantTo('create user'); $I->haveSoapHeader('Session', array('token' => '123456')); $I->sendSoapRequest('CreateUser', Xml::build() ->user->email->val('miles@davis.com')); -$I->seeSoapResponseIncludes(Xml::build() +$I->seeSoapResponseIncludes(\Codeception\Util\Xml::build() ->result->val('Ok') ->user->attr('id', 1) ); diff --git a/docs/12-ContinuousIntegration.md b/docs/12-ContinuousIntegration.md index bf077354af..ae89177be1 100644 --- a/docs/12-ContinuousIntegration.md +++ b/docs/12-ContinuousIntegration.md @@ -31,7 +31,7 @@ At first we need to create build project. Depending on your needs you can set up We need to define build steps. The most simple setup may look like this: ``` -php codecept run +php vendor/bin/codecept run ``` ![Jenkins Codeception Build Step](http://codeception.com/images/jenkins/Jenk5.png) @@ -47,7 +47,7 @@ But we don't want to analyze console output for each failing build. Especially I Now let's update our build step to generate xml: ``` -php codecept run --xml +php vendor/bin/codecept run --xml ``` and ask Jenkins to collect resulted XML. This can be done as part of Post-build actions. Let's add *Publish xUnit test result report* action and configure it to use with PHPUnit reports. @@ -65,7 +65,7 @@ Now for all builds we will see results trend graph that shows us percentage of p To get more details on steps executed you can generate HTML report and use Jenkins to display them. ``` -php codecept run --html +php vendor/bin/codecept run --html ``` Now we need HTML Publisher plugin configured to display generated HTML files. It should be added as post-build action similar way we did it for XML reports. @@ -93,7 +93,7 @@ As an alternative you can use 3rd-party [TeamCity extension](https://github.com/ After you create build project you should define build step with Codeception which is ``` -php codecept run --report +php vendor/bin/codecept run --report ``` ![build step](http://codeception.com/images/teamcity/build.png) @@ -109,7 +109,7 @@ Once you execute your first build you should see detailed report inside TeamCity Travis CI is popular service CI with good GitHub integration. Codeception is self-tested with Travis CI. There nothing special about configuration. Just add to the bottom line of travis configuration: ```yaml -php codecept run +php vendor/bin/codecept run ``` More details on configuration can be learned from Codeception's [`.travis.yml`](https://github.com/Codeception/Codeception/blob/master/.travis.yml).