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
Continue to <a href="http://codeception.com/docs/03-AcceptanceTests">Acceptance Testing Guide »</a>
84
+
</div>
85
+
86
+
To run the tests you will need firefox browser, [selenium server running](http://codeception.com/docs/modules/WebDriver#Selenium). If this requirements met acceptance tests can be executed as
87
+
88
+
```
89
+
php bin/codecept run acceptance
90
+
```
91
+
65
92
### BDD
66
93
67
94
If you prefer to describe application with feature files, Codeception can turn them to acceptance tests. It is recommended to store feature files in `features` directory (like it does Behat) but symlinking it to `tests/acceptance/features` so they can be treated as tests too.
@@ -78,6 +105,11 @@ There is no standard Gherkin steps built in. By writing your feature files you c
This will create `tests` dir inside `src/AppBundle`.
90
122
123
+
### Functional Testing
124
+
125
+
There is no need to use `WebTestCase` to write functional tests. Symfony functional tests aew written in the same manner as acceptance tests but are executed inside a framework. Codeception has `Symfony` module for it. It is a good idea to separate functional and unit tests so it is recommended to create a new test suite for AppBundle
Functional tests are written in the same manner as acceptance tests. They also use scenario and `$I` actor object. The only difference is how they are executed. To run tests as Symfony test you should enable corresponding module in functional suite configureation file `src/Appundle/tests/functional.suite.yml`. Probably you want Doctrine to be included as well. Then you should use this configuration:
Learn more about starting with Symfony in <ahref="http://codeception.com/09-04-2015/using-codeception-for-symfony-projects.html">our blogpost »</a>
Continue to <ahref="http://codeception.com/docs/04-FunctionalTests">Functional Testing Guide »</a>
153
+
</div>
154
+
155
+
91
156
### Unit Testing
92
157
158
+
You should put your unit tests for AppBundle into `src/AppBundle/tests/unit`. It is done to not mix them with functional and API tests. To start unit test suite for `AppBundle` shoule be created:
93
159
160
+
```
161
+
php bin/codecept g:suite unit -c src/AppBundle
162
+
```
94
163
95
-
### Functional Testing
164
+
Codeception is powered by PHPUnit so unit and integration test work in a similar manner. To genereate a plain PHPUnit test for `Foo` class inside `AppBundle` please run
165
+
166
+
```
167
+
php bin/codecept g:phpunit unit Foo -c src/AppBundle
168
+
```
169
+
170
+
This generates a standard test inherited from `PHPUnit_Framework_TestCase`. For integration tests you may use Codeception-enhanced format which allows accessing services DI container, Doctrine, and others. To have it create a unit test extending `Codeception\Test\Unit` class:
Continue to <ahref="http://codeception.com/docs/05-UnitTests">Unit Testing Guide »</a>.
179
+
</div>
180
+
181
+
182
+
### Running it all together
183
+
184
+
Codeception allows to execute all tests with different configurations in one runner. To execute all tests at once with `codecept run` you should include bundle configurations into global configuration file `codeception.yml` in the root of a project:
185
+
186
+
```yaml
187
+
include:
188
+
- src/*Bundle
189
+
```
96
190
97
-
There is no need to use `WebTestCase`
191
+
Then running codeception tests from root directory will execute tests from all bundles as well as acceptance tests.
0 commit comments