Codeception review (PHP testing framework)

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. Having your application covered with tests gives you more trust in the stability of your application. That’s all.

In most cases, tests don’t guarantee that the application works 100% as it is supposed to. You can’t predict all possible scenarios and exceptional situations for complex apps, but with tests, you can cover the most important parts of your app and at least be sure they work as predicted.

There are plenty of ways to test your application. The most popular paradigm is Unit Testing. For web applications, testing just the controller and/or the model doesn’t prove that your application is working. To test the behavior of your application as a whole, you should write functional or acceptance tests.

Codeception supports all three testing types. Out of the box, you have tools for writing unit, functional, and acceptance tests in a unified framework.

Codeception Unit Tests Codeception Functional Tests Codeception Acceptance Tests
Scope of the test Single PHP class PHP Framework (Routing, Controllers, etc.) Page in browser (Chrome, Firefox, or PhpBrowser)
Testing computer needs access to project’s PHP files Yes Yes No
Web server required No No Yes
JavaScript No No Yes
Additional software required None None <ul><li>For WebDriver: Selenium Server or PhantomJS (deprecated)</li><li>For PhpBrowser: None</li></ul>
Test execution speed High High Low
Configuration file unit.suite.yml functional.suite.yml acceptance.suite.yml

One of the main advantages of Codeception is that you don’t have to decide on just one type of testing. You can have all three! And chances are, that you will (sooner or later) need all three. That’s why Codeception consists of three so-called “suites”: A “unit suite” for all unit tests, a “functional suite” for all functional tests, and an “acceptance suite” for all acceptance tests.

src: http://codeception.com/docs/01-Introduction

No reviews were found.