How to make Joomla CMS tests Better with Gherkin and Codeception?
All of us, Joomla! users, expect to have our favorite CMS improved regularly. And we expect too that the updates will bring us just new functionalities and not new errors. To reach this expectations, automated tests run each time that a new change is made in the code to check the basic functionalities.
The challenge is: how to make these tests better?
During this summer I will be working on a project to introduce Behaviour Driven Development (BDD) practices into Joomla. Behavior-driven development (BDD) is an agile software development technique that encourages collaboration between developers, QA and non-technical or business participants in a software project.
I’m Ph.D researcher working on an “Analytical study and comparison of PHP based various open source CMS for modelling of automated testing suites” at Saurashtra University. I was teaching in BCA (bachelor of computer application) at Sardar Patel Kelavni Mandal - Jetpur.
My husband Gunjan Patel introduced me to J!Family since many years ago. I have started contributing and getting involved since 5 month by joining Automated Testing Working Group. I know Joomla! Community since long time and feeling proud to be part of it now.
The Google Summer of Code (GSoC) is a global program focused on introducing students to open source software development. Students work on a 3 month programming project with an open source organization during their break from university. Which helps students who get the opportunity to work with mentors on a variety of coding projects that will all be contributed back to the student's mentoring organization, in my case the Joomla! Project.
This summer I will be working on writing Browser Automated Tests for Content and User features for Joomla! CMS using Gherkin and Codeception language along with Robo.li and Selenium tools. The mentors of the project are Javier Gómez, Niels Braczek and Yves Hoppe. The project will be developed in a Github repo throughout the summer (May 23 – August 15). Feel free to review the progress and add your suggestions.
Gherkin is the language which is a Business Readable, Domain Specific Language that lets us describe software’s behaviour without detailing how that behaviour is implemented. Mainly Gherkin serves two purposes — documentation and automated tests. It is actually like you are reading a storybook, it defines software feature in easily understandable stories which helps non technical, Business Analyst and Sales persons to understand the flow and feature of the software. For the developer Gherkin code is like talking to you, telling you what code you should write.
Brief Overview of project
When thinking about this project “Browser Automated Tests for Joomla! CMS(covering Users and Content features)” the main concern is Users and content feature.The major goal of this project is to create system acceptance suits for joomla User Management and Content features for Joomla 3.x in all possible scenario writing in BDD based using Gherkin.
Example scenario written in gherkin -
Test will have to cover the User cases of: creating, editing, removing, publishing articles of content and being modified by different user roles. Create the integration tests that links the Administrator, the Frontend (by creating menu items) and the Modules and Plugins applications that are related to the Users and Content Features.
Building use cases of CRUD for default access levels
Joomla provides different access level by default with installation. Needs to create use case for them all for Articles and their categories.
Create article and category menu item and assure that it works like expected in backend and frontend.
Change/Update, publishing, unpublishing, auto publishing, changing title etc using Frontend Editing feature which joomla provides.
Building use cases of CRUD in different access level and groups.
Assure user group and their access. Like backend login, frontend editing etc…
Creating new access level and assign it to user and assure it’s access
Create menu item for user and register user from frontend and update.
Setup a new field using profile plugin and assure it’s working like expected
Digging into the Joomla CMS, Content and User extensions and writing list of all possible scenarios based on scope using Gherkin. It will be a complete capture of further development and it may help to start actual code development.
Start developing acceptance suits for User extensions based on scope and scenarios. I will try my best to make the file structure and code structure be user friendly and also proper documentation will be provided with the code line.
I heartily thanks to My mentors for helping me understand this project better and I hope I don’t break their trust and do my job in the best possible manner. I hope that by my skills and efforts will benefit the Joomla community.
I would also like to thank whole Google Summer of Code 2016 team and Joomla! Community.