Skip to content

Commit d71e52a

Browse files
committed
auto updated documentation
1 parent 97b08ca commit d71e52a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2217
-2717
lines changed

_includes/guides.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<li><a href="/docs/01-Introduction">Introduction</a></li><li><a href="/docs/02-GettingStarted">Getting Started</a></li><li><a href="/docs/03-ModulesAndHelpers">Modules And Helpers</a></li><li><a href="/docs/04-AcceptanceTests">Acceptance Tests</a></li><li><a href="/docs/05-FunctionalTests">Functional Tests</a></li><li><a href="/docs/06-UnitTests">Unit Tests</a></li><li><a href="/docs/07-AdvancedUsage">Advanced Usage</a></li><li><a href="/docs/08-Customization">Customization</a></li><li><a href="/docs/09-Data">Data</a></li><li><a href="/docs/10-WebServices">Web Services</a></li><li><a href="/docs/11-Codecoverage">Codecoverage</a></li><li><a href="/docs/12-ParallelExecution">Parallel Execution</a></li>
1+
<li><a href="/docs/01-Introduction">Introduction</a></li><li><a href="/docs/02-GettingStarted">Getting Started</a></li><li><a href="/docs/03-AcceptanceTests">Acceptance Tests</a></li><li><a href="/docs/04-FunctionalTests">Functional Tests</a></li><li><a href="/docs/05-UnitTests">Unit Tests</a></li><li><a href="/docs/06-ReusingTestCode">Reusing Test Code</a></li><li><a href="/docs/07-AdvancedUsage">Advanced Usage</a></li><li><a href="/docs/08-Customization">Customization</a></li><li><a href="/docs/09-Data">Data</a></li><li><a href="/docs/10-WebServices">Web Services</a></li><li><a href="/docs/11-Codecoverage">Codecoverage</a></li><li><a href="/docs/12-ParallelExecution">Parallel Execution</a></li>

_includes/modules.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<li><a href="/docs/modules/AMQP">AMQP</a></li><li><a href="/docs/modules/Phalcon1">Phalcon1</a></li><li><a href="/docs/modules/Asserts">Asserts</a></li><li><a href="/docs/modules/PhpBrowser">PhpBrowser</a></li><li><a href="/docs/modules/Cli">Cli</a></li><li><a href="/docs/modules/Queue">Queue</a></li><li><a href="/docs/modules/Db">Db</a></li><li><a href="/docs/modules/REST">REST</a></li><li><a href="/docs/modules/Dbh">Dbh</a></li><li><a href="/docs/modules/Redis">Redis</a></li><li><a href="/docs/modules/Doctrine1">Doctrine1</a></li><li><a href="/docs/modules/SOAP">SOAP</a></li><li><a href="/docs/modules/Doctrine2">Doctrine2</a></li><li><a href="/docs/modules/Sequence">Sequence</a></li><li><a href="/docs/modules/FTP">FTP</a></li><li><a href="/docs/modules/Silex">Silex</a></li><li><a href="/docs/modules/Facebook">Facebook</a></li><li><a href="/docs/modules/Symfony1">Symfony1</a></li><li><a href="/docs/modules/Filesystem">Filesystem</a></li><li><a href="/docs/modules/Symfony2">Symfony2</a></li><li><a href="/docs/modules/Kohana">Kohana</a></li><li><a href="/docs/modules/WebDriver">WebDriver</a></li><li><a href="/docs/modules/Laravel4">Laravel4</a></li><li><a href="/docs/modules/XMLRPC">XMLRPC</a></li><li><a href="/docs/modules/Laravel5">Laravel5</a></li><li><a href="/docs/modules/Yii1">Yii1</a></li><li><a href="/docs/modules/Lumen">Lumen</a></li><li><a href="/docs/modules/Yii2">Yii2</a></li><li><a href="/docs/modules/Memcache">Memcache</a></li><li><a href="/docs/modules/ZF1">ZF1</a></li><li><a href="/docs/modules/MongoDb">MongoDb</a></li><li><a href="/docs/modules/ZF2">ZF2</a></li>
1+
<li><a href="/docs/modules/AMQP">AMQP</a></li><li><a href="/docs/modules/PhpBrowser">PhpBrowser</a></li><li><a href="/docs/modules/Asserts">Asserts</a></li><li><a href="/docs/modules/Queue">Queue</a></li><li><a href="/docs/modules/Cli">Cli</a></li><li><a href="/docs/modules/REST">REST</a></li><li><a href="/docs/modules/Db">Db</a></li><li><a href="/docs/modules/Redis">Redis</a></li><li><a href="/docs/modules/Dbh">Dbh</a></li><li><a href="/docs/modules/SOAP">SOAP</a></li><li><a href="/docs/modules/Doctrine2">Doctrine2</a></li><li><a href="/docs/modules/Sequence">Sequence</a></li><li><a href="/docs/modules/FTP">FTP</a></li><li><a href="/docs/modules/Silex">Silex</a></li><li><a href="/docs/modules/Facebook">Facebook</a></li><li><a href="/docs/modules/Symfony2">Symfony2</a></li><li><a href="/docs/modules/Filesystem">Filesystem</a></li><li><a href="/docs/modules/WebDriver">WebDriver</a></li><li><a href="/docs/modules/Laravel4">Laravel4</a></li><li><a href="/docs/modules/XMLRPC">XMLRPC</a></li><li><a href="/docs/modules/Laravel5">Laravel5</a></li><li><a href="/docs/modules/Yii1">Yii1</a></li><li><a href="/docs/modules/Lumen">Lumen</a></li><li><a href="/docs/modules/Yii2">Yii2</a></li><li><a href="/docs/modules/Memcache">Memcache</a></li><li><a href="/docs/modules/ZF1">ZF1</a></li><li><a href="/docs/modules/MongoDb">MongoDb</a></li><li><a href="/docs/modules/ZF2">ZF2</a></li><li><a href="/docs/modules/Phalcon1">Phalcon1</a></li>

changelog.markdown

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,42 @@ title: Codeception Changelog
77

88
# Changelog
99

10+
#### 2.1.0
11+
12+
* <strong>[Recorder]</strong>(https://github.com/Codeception/Codeception/tree/master/ext#codeceptionextensionrecorder) extension added. Shows acceptance test progress with a recorded slideshow.
13+
* **Updated to Guzzle 6**. Codeception can now work both with Guzzle v5 and Guzzle v6. PhpBrowser chooses right connector depending on Guzzle version installed. By <strong><a href="https://github.com/davertmik">@davertmik</a></strong> and <strong><a href="https://github.com/enumag">@enumag</a></strong>
14+
* Annotations in Cept files.
15+
Instead of calling `$scenario->skip()`, `$scenario->group('firefox')`, etc, it is recommended to set scenario metadata with annotations `// <strong><a href="https://github.com/skip">@skip</a></strong>`, `// <strong><a href="https://github.com/group">@group</a></strong> firefox`.
16+
Annotations can be parsed from line or block comments. `$scenario->skip()` and `$scenario->incomplete()` are still valid and can be executed inside conditional statements:
17+
```
18+
if (!extension_loaded('xdebug')) $scenario->skip('Xdebug required')
19+
```
20+
* **PSR-4**: all support classes moved to `tests/_support` by default. Actors, Helpers, PageObjects, StepObjects, GroupObjects to follow PSR-4 naming style. Autoloader implemented by <strong><a href="https://github.com/splinter89">@splinter89</a></strong>.
21+
* **Dependency Injection**: support classes can be injected into tests. Support classes can be injected into each other too. This happens by implementing method `_inject` and explicitly specifying class names as parameters. Implemented by <strong><a href="https://github.com/splinter89">@splinter89</a></strong>.
22+
* **Actor classes can be extended**, their generated parts were moved to special traits in `_generated` namespace. Each *Tester class can be updated with custom methods.
23+
* **Module config simplified**: Modules can be configured in `enabled` section of suite config.
24+
* **Conflicts**: module can define conflicts with each other by implementing `_conflicts` method
25+
* **Dependencies**: module can explicitly define dependencies and expect their injection by implementing `_inject` and `_depends` methods and relying on dependency injection container.
26+
* **Current** modules, environment, and test name can be received in scenario. Example: `$scenario->current('env')` returns current environment name. Fixes <a href="https://github.com/Codeception/Codeception/issues/1251">#1251</a>
27+
* **Environment Matrix**: environments can be merged. Environment configs can be created in `tests/_envs`, environment generator added. Implemented by By <strong><a href="https://github.com/sjableka">@sjableka</a></strong>. See <a href="https://github.com/Codeception/Codeception/issues/1747">#1747</a>
28+
* **Custom Printers**: XML, JSON, TAP, Report printers can be redefined in configuration. See <a href="https://github.com/Codeception/Codeception/issues/1425">#1425</a>
29+
* <strong>[Db]</strong> Added `reconnect` option for long running tests, which will connect to database before the test and disconnect after. By <strong><a href="https://github.com/Naktibalda">@Naktibalda</a></strong>
30+
* Module parts. Actions of modules can be loaded partially in order to disable actions which are not used in current tests. For instance, disable web actions of framework modules in unit testsing.
31+
* **Kohana**, **Symfony1**, **Doctrine1** modules considered deprecated and moved to standalone packages.
32+
* `shuffle` added to settings. Randomizes order of running tests. See <a href="https://github.com/Codeception/Codeception/issues/1504">#1504</a>
33+
* Console output improved: scenario stack traces contain files and lines of fail.
34+
* <strong>[Doctrine2]</strong><strong>[Symfony2]</strong> `symfony_em_service` config option moved from Doctrine2 to Symfony2 module and renamed to `em_service` *2015-06-03*
35+
* <strong>[PhpBrowser]</strong><strong>[Frameworks]</strong> Fixed cloning form nodes `Codeception\Lib\InnerBrowser::getFormFromCrawler(): ID XXX already defined` *2015-05-13*
36+
* <strong>[WebDriver]</strong> session snapshot implemented, allows to store cookies and load them, i.e., to keep user session between testss.
37+
* <strong>[WebDriver]</strong><strong>[PhpBrowser]</strong><strong>[Frameworks]</strong> Malformed XPath locators wil throw an exception <a href="https://github.com/Codeception/Codeception/issues/1441">#1441</a>
38+
* `MODULE_INIT` event is fired before initializing modules <a href="https://github.com/Codeception/Codeception/issues/1370">#1370</a>
39+
* Graceful tests termination using `pcntl_signal`. See <a href="https://github.com/Codeception/Codeception/issues/1286">#1286</a>
40+
* Group classes renamed to GroupObjects; Base GroupObject class renamed to `Codeception\GroupObject`
41+
* Official extensions moved to `ext` dir; Base Extension class renamed to `Codeception\Extension`
42+
* Duplicate environment options won't cause Codeception to run environment tests twice
43+
* <strong>[Phalcon1]</strong> `haveServiceInDi` method implemented by <strong><a href="https://github.com/sergeyklay">@sergeyklay</a></strong>
44+
* <strong>[Db]</strong> `seeNumRecords` method added by <strong><a href="https://github.com/sergeyklay">@sergeyklay</a></strong>
45+
1046
#### 2.0.15
1147

1248
* <strong>[Phalcon1]</strong> Fixed getting has more than one field by <strong><a href="https://github.com/sergeyklay">@sergeyklay</a></strong> <a href="https://github.com/Codeception/Codeception/issues/2010">#2010</a>.
@@ -116,6 +152,11 @@ Modifications to ensure multiple values get sent correctly.
116152
* <strong>[Yii2]</strong> Fixed usage of PUT method by <strong><a href="https://github.com/miroslav">@miroslav</a></strong>-chandler *2015-02-23*
117153

118154

155+
#### 2.1.0
156+
157+
* <strong>[WebDriver]</strong> Saving and restoring session snapshots implemented *2015-03-16*
158+
159+
119160
#### 2.0.10
120161

121162
* **Console Improvement**: better formatting of test progress. Improved displaying of debug messages and PHP Fatal Errors.

docs/01-Introduction.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
</div>
2+
13
---
24
layout: doc
35
title: Introduction - Codeception - Documentation
46
---
57

6-
{% include switch.html %}
7-
88
# Introduction
99

1010
The idea behind testing is not new. You can't sleep well if you are not confident that your last commit didn't take down the whole application.
@@ -34,7 +34,7 @@ Please, note that **any website** can be covered with acceptance tests. Even if
3434
$I = new AcceptanceTester($scenario);
3535
$I->amOnPage('/');
3636
$I->click('Sign Up');
37-
$I->submitForm('#signup', array('username' => 'MilesDavis', 'email' => 'miles@davis.com'));
37+
$I->submitForm('#signup', ['username' => 'MilesDavis', 'email' => 'miles@davis.com']);
3838
$I->see('Thank you for Signing Up!');
3939
?>
4040

@@ -70,10 +70,10 @@ For functional tests your application should be prepared to be run in a test env
7070
$I = new FunctionalTester($scenario);
7171
$I->amOnPage('/');
7272
$I->click('Sign Up');
73-
$I->submitForm('#signup', array('username' => 'MilesDavis', 'email' => 'miles@davis.com'));
73+
$I->submitForm('#signup', ['username' => 'MilesDavis', 'email' => 'miles@davis.com']);
7474
$I->see('Thank you for Signing Up!');
7575
$I->seeEmailSent('miles@davis.com', 'Thank you for registration');
76-
$I->seeInDatabase('users', array('email' => 'miles@davis.com'));
76+
$I->seeInDatabase('users', ['email' => 'miles@davis.com']);
7777
?>
7878

7979
{% endhighlight %}
@@ -111,7 +111,7 @@ function testSavingUser()
111111
$user->setSurname('Davis');
112112
$user->save();
113113
$this->assertEquals('Miles Davis', $user->getFullName());
114-
$this->unitTester->seeInDatabase('users',array('name' => 'Miles', 'surname' => 'Davis'));
114+
$this->unitTester->seeInDatabase('users', ['name' => 'Miles', 'surname' => 'Davis']);
115115
}
116116
?>
117117

@@ -138,4 +138,4 @@ It could be called a BDD framework. All Codeception tests are written in a descr
138138

139139

140140

141-
* **Next Chapter: [GettingStarted >](/docs/02-GettingStarted)**<p>&nbsp;</p><div class="alert alert-warning">Docs are incomplete? Outdated? Or you just found a typo? <a href="https://github.com/Codeception/Codeception/tree/2.0/docs">Help us to improve documentation. Edit it on GitHub</a></div>
141+
* **Next Chapter: [GettingStarted >](/docs/02-GettingStarted)**

docs/02-GettingStarted.md

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
</div>
2+
13
---
24
layout: doc
35
title: Getting Started - Codeception - Documentation
@@ -11,11 +13,21 @@ Let's take a look at Codeception's architecture. We assume that you already [ins
1113

1214
One of the main concepts of Codeception is representation of tests as actions of a person. We have a UnitTester, who executes functions and tests the code. We also have a FunctionalTester, a qualified tester, who tests the application as a whole, with knowledge of its internals. And an AcceptanceTester, a user that works with our application through an interface that we provide.
1315

14-
Each of these Actors are PHP classes along with the actions that they are allowed to do. As you can see, each of these Actors have different abilities. They are not constant, you can extend them. One Actor belongs to one testing suite.
16+
Actor classes are not written but generated from suite configuration. **Methods of actor classes are generally taken from Codeception Modules**. Each module provides predefined actions for different testing purposes, and they can be combined to fit the testng environment. Codeception tries to solve 90% of possible testing issues in its modules, so you don't have reinvent the wheel. We think that you can spend more time on writing tests and less on writing support code to make those tests run. By default AcceptanceTester relies on PhpBrowser module, which is set in `tests/acceptance.suite.yml` configuration file:
17+
18+
{% highlight yaml %}
19+
20+
class_name: AcceptanceTester
21+
modules:
22+
enabled:
23+
- PhpBrowser:
24+
url: http://localhost/myapp/
25+
- \Helper\Acceptance
1526

16-
Actor classes are not written but generated from suite configuration. When you change configuration, actor classes are **rebuilt automatically**.
27+
{% endhighlight %}
1728

18-
If Actor classes are not created or updated as you expect, try to generate them manually with `build` command:
29+
In this configuration file you can enable/disable and reconfigure modules for your needs.
30+
When you change configuration, actor classes are rebuilt automatically. If Actor classes are not created or updated as you expect, try to generate them manually with `build` command:
1931

2032
{% highlight bash %}
2133

@@ -68,9 +80,12 @@ Before we execute this test, we should make sure that the website is running on
6880

6981
{% highlight yaml %}
7082

71-
config:
72-
PhpBrowser:
73-
url: 'http://myappurl.local'
83+
class_name: AcceptanceTester
84+
modules:
85+
enabled:
86+
- PhpBrowser:
87+
url: 'http://myappurl.local'
88+
- \Helper\Acceptance
7489

7590
{% endhighlight %}
7691

@@ -131,28 +146,70 @@ OK (1 test, 1 assertions)
131146

132147
{% endhighlight %}
133148

134-
That was a very simple test that you can reproduce for your own website.
135-
By emulating the user's actions you can test all of your websites the same way.
149+
This simple test can be extended to a complete scenario of site usage.
150+
So by emulating the user's actions you can test any of your websites.
136151

137152
Give it a try!
138153

139-
## Modules and Helpers
140-
141-
The actions in Actor classes are taken from modules. Generated Actor classes emulate multiple inheritance. Modules are designed to have one action performed with one method. According to the [DRY principle](http://en.wikipedia.org/wiki/Don%27t_repeat_yourself), if you use the same scenario components in different modules, you can combine them and move them to a custom module. By default each suite has an empty module, which can be used to extend Actor classes. They are stored in the __support__ directory.
142-
143154
## Bootstrap
144155

145156
Each suite has its own bootstrap file. It's located in the suite directory and is named `_bootstrap.php`. It will be executed before test suite. There is also a global bootstrap file located in the `tests` directory. It can be used to include additional files.
146157

147-
## Test Formats
158+
## Cept, Cest and Test Formats
159+
160+
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/06-UnitTests), and Cest format.
161+
162+
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 a several test (one per each operation):
148163

149-
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/06-UnitTests), and [class-based Cest](http://codeception.com/docs/07-AdvancedUsage#Cest-Classes) format. They are covered in later chapters. There is no difference in the way the tests of either format will be run in the suite.
164+
{% highlight php %}
165+
166+
<?php
167+
class PageCrudCest
168+
{
169+
function _before(AcceptanceTester $I)
170+
{
171+
// will be executed at the beginning of each test
172+
$I->amOnPage('/');
173+
}
174+
175+
function createPage(AcceptanceTester $I)
176+
{
177+
// todo: write test
178+
}
179+
180+
function viewPage(AcceptanceTester $I)
181+
{
182+
// todo: write test
183+
}
184+
185+
function updatePage(AcceptanceTester $I)
186+
{
187+
// todo: write test
188+
}
189+
190+
function deletePage(AcceptanceTester $I)
191+
{
192+
// todo: write test
193+
}
194+
}
195+
?>
196+
197+
{% endhighlight %}
198+
199+
Such Cest file can be created by running a generator:
200+
201+
{% highlight bash %}
202+
203+
$ php codecept.phar generate:cest acceptance PageCrud
204+
205+
{% endhighlight %}
206+
207+
Learn more about [Cest format](http://codeception.com/docs/07-AdvancedUsage#Cest-Classes) in Advanced Testing section.
150208

151209
## Configuration
152210

153211
Codeception has a global configuration in `codeception.yml` and a config for each suite. We also support `.dist` configuration files. If you have several developers in a project, put shared settings into `codeception.dist.yml` and personal settings into `codeception.yml`. The same goes for suite configs. For example, the `unit.suite.yml` will be merged with `unit.suite.dist.yml`.
154212

155-
156213
## Running Tests
157214

158215
Tests can be started with the `run` command.
@@ -251,5 +308,5 @@ We took a look into the Codeception structure. Most of the things you need were
251308

252309

253310

254-
* **Next Chapter: [ModulesAndHelpers >](/docs/03-ModulesAndHelpers)**
255-
* **Previous Chapter: [< Introduction](/docs/01-Introduction)**<p>&nbsp;</p><div class="alert alert-warning">Docs are incomplete? Outdated? Or you just found a typo? <a href="https://github.com/Codeception/Codeception/tree/2.0/docs">Help us to improve documentation. Edit it on GitHub</a></div>
311+
* **Next Chapter: [AcceptanceTests >](/docs/03-AcceptanceTests)**
312+
* **Previous Chapter: [< Introduction](/docs/01-Introduction)**

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy