At Kunstmaan we always try to devilver high quality projects. This implicates that we (developers) are spending quite some time writing unit- and functional tests, in order to prevent regressions from being introduced and released. For our functional tests, we are using the popular Behat framework.
Behat is a tool that makes behavior driven development (BDD) possible. With BDD, you write human-readable stories that describe the behavior of your application. These stories can then be auto-tested against your application.
Our entire content management workflow is based upon pages and pageparts. A page consists of a number of default and/or custom pageparts. These pageparts allow us to offer advanced page content to end users, without sacrificing usability, abstraction of technical implementation and content from prestation separation.
Recently, we have introduced the pagepart generator, and today were are releasing a feature on top of it. From now on it is possible to automatically generate Behat tests when you create a new pagepart. Those generated Behat tests will work out of the box, without touching one line of code. Only when you make some changes to the pagepart itself, or to the HTML presentation, you should make some minor changes to the generated tests. This new feature will save you time, while making sure that all pageparts on your site are completely tested.
Pagepart testing scenario:
- Create a BehatTestPage as child page of the Homepage
- For each Page that will use the pagepart: create it as child page of the BehatTestPage
- Select the page template where the pagepart can be added
- Add a new pagepart to the correct section
- Check the published page, to see if the pagepart is shown
- Edit the pagepart, and fill in other values
- Check the published page again, to see if the pagepart values have changed
- Delete the pagepart
- Check the published page again, to see if the pagepart was successfully removed
- Delete the BehatTestPage, and thus also delete all the child pages
When you want to try this new feature, just follow the getting started guide for creating a new project, and make sure you have generated the admin-tests.
Note: A video that will demonstrate this new feature will be uploaded soon.