This release brings a real behavior driven development to Codeception. Before that we talked about testing in BDD-style, but nothing about real development by behavior. There were just few changes made in code. More changes are coming to documentation.
Specifications
With Behavior Driven Development you start development of class by writing it’s specifications. Specifications are written as methods of Cest class and start with ‘should’ word.
The EventMachine class in example above is not written, but we’ve already defined what to expect from it. After a basic requirements are specified we can take a deeper look into it and describe how it should be used. From this point your specifications become a valid Codeception tests.
For full EventMachineCest example see my Gist on Github.
Codeception generates a pretty good documentation with DocBlox based on your scenario. The @doc annotation marks that a getState method documentation will be updated by current test scenario.
Scenarios
For making acceptnace tests usable for writing Stories we’ve added 2 new methods. It’s am and lookForwardTo which represent ‘As a …’ and ‘So that’ definitions from Story.
After that Cept can be extended in a valid Cept file. Refer to this Gist demonstrates for example.
Bugfixes
- seeLink and dontSeeLink for acceptance tests were fixed. Thanks to Kanstantsin Kamkou.
- comments are displayed in output as well as actions.
- Selenium docs updated.
Please update your version via PEAR:
or download updated Phar package.