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
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,43 @@ title: Codeception Changelog
7
7
8
8
# Changelog
9
9
10
+
#### 2.3.4
11
+
12
+
* Added `@prepare` annotation to make realtime configuration for tests in Cest and Test classes. [See documentation](http://codeception.com/docs/06-ModulesAndHelpers#Runtime-Configuration-of-a-Test).
13
+
14
+
Example: disabling Doctrine2 database transaction for a test
15
+
16
+
```php
17
+
<?php
18
+
/**@prepare disableTransactions */
19
+
function testDoctrine()
20
+
{
21
+
}
22
+
23
+
protected function disableTransactions(Doctrine2 $module)
24
+
{
25
+
$module->_reconfigure(['cleanup' => false]);
26
+
}
27
+
```
28
+
***[WebDriver]****SmartWait**. Automatically waits for a few extra seconds for element to appear on a page before failing. Can reduce high usage of `wait*` methods. [See Documentation](http://codeception.com/docs/03-AcceptanceTests#SmartWait)
29
+
* Added [RunProcess extension](http://codeception.com/extensions#RunProcess). Use it to start/stop Selenium (or other process) automatically for a test suite.
30
+
***[WebDriver]** Customization improvements:
31
+
* added `start` option to disable autostart of a browser for tests. (can be useful for Cloud testing setups)
32
+
* added `_capabilities` method for setting desired capabilities in runtime (can be combined with `@prepare` annotation)
33
+
*`_initializeSession` and `_closeSession` can be used in Helpers to start and stop browser manually (combine with `start: false` config)
34
+
* Fixed running a single test from a global config when using included configs. See [#4366](https://github.com/Codeception/Codeception/issues/4366) by **[zebraf1](https://github.com/zebraf1)** (improves PhpStorm integration)
35
+
*[Doctrine2][Laravel5][Yii2][Phalcon] Print debug information for started/stopped transactions in tests. See [#4352](https://github.com/Codeception/Codeception/issues/4352)
36
+
*[PhpBrowser][Frameworks] click with context respects base tag [#4330](https://github.com/Codeception/Codeception/issues/4330) by **[Naktibalda](https://github.com/Naktibalda)**.
37
+
***[Yii2]** Split `cleanup` configuration option (backward-compatible): ([#4379](https://github.com/Codeception/Codeception/issues/4379) by **[leandrogehlen](https://github.com/leandrogehlen)**)
38
+
*`cleanup` - to cleanup loaded fixtures
39
+
*`transaction` - wrap tes into transaction
40
+
***[Asserts]** Added `assertStringStartsWith` and `assertArraySubset` by **[guidocella](https://github.com/guidocella)**
41
+
***[Db]** Added `updateInDatabase` method by **[eXorus](https://github.com/eXorus)**. See [#4385](https://github.com/Codeception/Codeception/issues/4385)
42
+
* In helpers and modules to check `$module::$excludeActions` property for existence before accessing it. Fixes [#4381](https://github.com/Codeception/Codeception/issues/4381) by **[CactusCoder](https://github.com/CactusCoder)**
43
+
***[Symfony]** Fixed printing debug response when `Symfony::extractRawRoles()` failed on security collector (Symfony >= 3.3) [#4309](https://github.com/Codeception/Codeception/issues/4309) by **[Basster](https://github.com/Basster)**
44
+
***[Laravel5]** Fixed bug with `disable_exception_handling` functionality. See [#4370](https://github.com/Codeception/Codeception/issues/4370). By **[janhenkgerritsen](https://github.com/janhenkgerritsen)**
45
+
***[Db]** Added `grabColumnFromDatabase` to fetches values from the column in database. By **[RebOOter](https://github.com/RebOOter)**
46
+
10
47
#### 2.3.3
11
48
12
49
* Fixed running with `--coverage`, `--xml`, `--html` options without parameters (Symfony Console 3.3 compatibility).
* you can still show this code to managers and clients
111
-
* stable enough: only major code changes, or moving to other framework, can break them
112
-
113
-
#### Cons
114
-
115
-
* JavaScript and AJAX can't be tested
116
-
* by emulating the browser you might get more false-positive results
117
-
* requires a framework
118
-
119
93
### Unit Tests
120
94
121
95
Testing pieces of code before coupling them together is highly important as well. This way,
@@ -147,19 +121,6 @@ function testSavingUser()
147
121
148
122
{% endhighlight %}
149
123
150
-
#### Pros
151
-
152
-
* fastest (well, in the current example, you still need database repopulation because it's an integration test,
153
-
not a pure unit test)
154
-
* can cover rarely used features
155
-
* can test the stability of the application core
156
-
* fundamental for any developer
157
-
158
-
#### Cons
159
-
160
-
* doesn't test connections between units
161
-
* unstable in support: very sensitive to code changes
162
-
163
124
## Conclusion
164
125
165
126
Despite the wide popularity of *TDD* (Test Driven Development), some PHP developers never write automated tests for their applications mostly because they think it's hard, slow or boring.
Copy file name to clipboardExpand all lines: docs/02-GettingStarted.md
+34-1Lines changed: 34 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,47 @@ and bootstrapped your first test suites. Codeception has generated three of them
10
10
They are well described in the [previous chapter](http://codeception.com/docs/01-Introduction). Inside your __/tests__ folder you will have three `.yml` config files and three directories
11
11
with names corresponding to these suites: `unit`, `functional`, `acceptance`. Suites are independent groups of tests with a common purpose.
12
12
13
+
## The Codeception Syntax
14
+
15
+
Codeception follows simple naming rules to make it easy to remember (as well as easy to understand) its method names.
16
+
17
+
***Actions** start with a plain english verb, like "click" or "fill". Examples:
18
+
{% highlight php %}
19
+
20
+
<?php
21
+
$I->click('Login');
22
+
$I->fillField('#input-username', 'John Dough');
23
+
$i->pressKey('#input-remarks', 'foo');
24
+
25
+
{% endhighlight %}
26
+
* **Assertions** always start with "see" or "dontSee". Examples:
27
+
{% highlight php %}
28
+
29
+
<?php
30
+
$I->see('Welcome');
31
+
$I->seeInTitle('My Company');
32
+
$i->seeElement('nav');
33
+
$i->dontSeeElement('#error-message');
34
+
$i->dontSeeInPageSource('<sectionclass="foo">');
35
+
36
+
{% endhighlight %}
37
+
* **Grabbers** just *read* something from the page, but don't process it. The return value of those are meant to be saved as variables and used later. Example:
One of the main concepts of Codeception is representation of tests as actions of a person.
16
49
We have a UnitTester, who executes functions and tests the code. We also have a FunctionalTester, a qualified tester,
17
50
who tests the application as a whole, with knowledge of its internals. Lastly we have an AcceptanceTester, a user who works with our application
18
51
through an interface that we provide.
19
52
20
-
Actor classes are not written but generated from suite configuration. **Methods of actor classes are generally taken from [Codeception Modules](http://codeception.com/docs/06-ModulesAndHelpers)**.
53
+
**Methods of actor classes are generally taken from [Codeception Modules](http://codeception.com/docs/06-ModulesAndHelpers)**.
21
54
Each module provides predefined actions for different testing purposes, and they can be combined to fit the testing environment.
22
55
Codeception tries to solve 90% of possible testing issues in its modules, so you don't have to reinvent the wheel.
23
56
We think that you can spend more time on writing tests and less on writing support code to make those tests run.
0 commit comments