Another release that despite the minor version change brings major improvements. Meet
1.6.4, which adds lots of new ways to customize your test automation platform and improve your tests. And yes, before reading this post take a cup of coffee. We prepared lots of features for you and this long post.
Long awaited feature of adding PageObjects into the core.
Codeception looks pretty different from other testing frameworks in Java or Ruby.
So it was hard to understand in which way the PageObject should be implemented.
Actually you can think of a PageObject that is just a storage of UI locators (UI Map).
In a test you can use such PageObject this way:
But how to make PageObjects actually to define page interaction too?
Can we improve that? Sure! In a test they may look like:
We have moved some logic into the PageObject class, and so we can reuse its methods in other tests.
Read more on generating PageObjects on newly updated Guides page.
Alternatively, interaction logic can be kept in StepObject classes. In which we recommend to define actions that may require passing through several pages. Also it may be useful if you want to define actions based on user roles.
AdminSteps class inherits from
WebGuy class, thus you have common actions from modules, as well as newly defined customized actions like
logout in your tests.
StepObjects are now in Guides too.
Groups && Extensions
Now it is possible to include 3rd party code into Codeception. Current options are pretty limited, you can extend Codeception only by listening to its internal events. Why do you need that? Not sure. But check out our Notifier extension that we prepared to demonstrate the power of extensions. Also you can develop your own alternative output formatter.
Group Classes are special extensions, that listen to events from a tests of a specific group. Thus, they are very if some tests require common environment setup. Group classes are also good for loading fixtures.
Here is the sample group class:
Read more about Groups and Extensions.
Pretty simple, yet useful feature when you want your test not to be stopped on failure.
This two assertions do just the same, but if
canSee fails to match ‘Hello World’ text on a page, it doesn’t stop the test. Still failed assertion will be displayed in final report.
Guides section about that.
Assertion Failure Messages Improved
For most Framework and Mink modules we improved the error messages that happen on failures. No more mystic messages like
failed asserting that 0 greater then 0. Better exceptions with better error reports.
Minor Fixes and Improvements
- codecoverage for multiple runner is now stored into right dir, thanks piccagliani.
- header actions were added to REST module by brutuscat.
- added environment management to Symfony2 module by SimonEast.
It is very important to execute “build” after the update.
Also this update has lots of changes, if you have an issues with them, please report them to Github.
If you have issues updating, fall back to previous version for now.
We are planning to introduce more humane stability politics soon. Wait for announcements.
codeception.phar for update:
for composer version