You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: changelog.markdown
+41Lines changed: 41 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,42 @@ title: Codeception Changelog
7
7
8
8
# Changelog
9
9
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><ahref="https://github.com/davertmik">@davertmik</a></strong> and <strong><ahref="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><ahref="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><ahref="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 <ahref="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><ahref="https://github.com/sjableka">@sjableka</a></strong>. See <ahref="https://github.com/Codeception/Codeception/issues/1747">#1747</a>
28
+
***Custom Printers**: XML, JSON, TAP, Report printers can be redefined in configuration. See <ahref="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><ahref="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 <ahref="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 <ahref="https://github.com/Codeception/Codeception/issues/1441">#1441</a>
38
+
*`MODULE_INIT` event is fired before initializing modules <ahref="https://github.com/Codeception/Codeception/issues/1370">#1370</a>
39
+
* Graceful tests termination using `pcntl_signal`. See <ahref="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><ahref="https://github.com/sergeyklay">@sergeyklay</a></strong>
44
+
* <strong>[Db]</strong> `seeNumRecords` method added by <strong><ahref="https://github.com/sergeyklay">@sergeyklay</a></strong>
45
+
10
46
#### 2.0.15
11
47
12
48
* <strong>[Phalcon1]</strong> Fixed getting has more than one field by <strong><ahref="https://github.com/sergeyklay">@sergeyklay</a></strong> <ahref="https://github.com/Codeception/Codeception/issues/2010">#2010</a>.
@@ -116,6 +152,11 @@ Modifications to ensure multiple values get sent correctly.
116
152
* <strong>[Yii2]</strong> Fixed usage of PUT method by <strong><ahref="https://github.com/miroslav">@miroslav</a></strong>-chandler *2015-02-23*
117
153
118
154
155
+
#### 2.1.0
156
+
157
+
* <strong>[WebDriver]</strong> Saving and restoring session snapshots implemented *2015-03-16*
158
+
159
+
119
160
#### 2.0.10
120
161
121
162
***Console Improvement**: better formatting of test progress. Improved displaying of debug messages and PHP Fatal Errors.
@@ -138,4 +138,4 @@ It could be called a BDD framework. All Codeception tests are written in a descr
138
138
139
139
140
140
141
-
***Next Chapter: [GettingStarted >](/docs/02-GettingStarted)**<p> </p><divclass="alert alert-warning">Docs are incomplete? Outdated? Or you just found a typo? <ahref="https://github.com/Codeception/Codeception/tree/2.0/docs">Help us to improve documentation. Edit it on GitHub</a></div>
Copy file name to clipboardExpand all lines: docs/02-GettingStarted.md
+74-17Lines changed: 74 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
</div>
2
+
1
3
---
2
4
layout: doc
3
5
title: Getting Started - Codeception - Documentation
@@ -11,11 +13,21 @@ Let's take a look at Codeception's architecture. We assume that you already [ins
11
13
12
14
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.
13
15
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
15
26
16
-
Actor classes are not written but generated from suite configuration. When you change configuration, actor classes are **rebuilt automatically**.
27
+
{% endhighlight %}
17
28
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:
19
31
20
32
{% highlight bash %}
21
33
@@ -68,9 +80,12 @@ Before we execute this test, we should make sure that the website is running on
68
80
69
81
{% highlight yaml %}
70
82
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
74
89
75
90
{% endhighlight %}
76
91
@@ -131,28 +146,70 @@ OK (1 test, 1 assertions)
131
146
132
147
{% endhighlight %}
133
148
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.
136
151
137
152
Give it a try!
138
153
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
-
143
154
## Bootstrap
144
155
145
156
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.
146
157
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):
148
163
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:
Learn more about [Cest format](http://codeception.com/docs/07-AdvancedUsage#Cest-Classes) in Advanced Testing section.
150
208
151
209
## Configuration
152
210
153
211
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`.
154
212
155
-
156
213
## Running Tests
157
214
158
215
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
***Previous Chapter: [< Introduction](/docs/01-Introduction)**<p> </p><divclass="alert alert-warning">Docs are incomplete? Outdated? Or you just found a typo? <ahref="https://github.com/Codeception/Codeception/tree/2.0/docs">Help us to improve documentation. Edit it on GitHub</a></div>
0 commit comments