Test Driven Development brings Stability to Zurmo Open Source CRM
By: Ray Stoeckicht
Test Driven Development
Test Driven Development, or just TDD, sits at the core of our entire engineering ethos. Zurmo is developed using an agile method, so tests play a very important role in development.
Without tests it would be very difficult to develop an application of this complexity and be sure that everything works correctly. We have unit tests (with code coverage of about 85%), functional tests, and walk-through tests, a mix between unit and functional tests, used to test if controller actions are executed correctly.
We developed our custom continuous integration environment, which covers unit tests, functional tests, code violation, checking for missing translation messages, performance, and more.
Prior to creating our own CI, we explored using Jenkins and Hudson. Since Zurmo is written in PHP and our developers are well versed in PHP, we wanted to make sure the tools we were using were easy for everyone to utilize. In the beginning, our CI evolved naturally.
We developed a few scripts and then a few more. Before we knew it, we were pretty far down the road and we did not want to expend the energy switching to something else when what we had fulfilled our requirements.
It might have taken more effort to rewrite everything to work with Jenkins or Hudson. In the future, we may consider switching to a new CI server, but for the time being, everything is working very well.
With an almost religious zeal for testing, you will find that our obsession with TDD means a more stable application. Gone are the days of upgrade and pray. Now it is upgrade and test. With the testing infrastructure in place, you can create and maintain a custom-built CRM system with the assurance that future updates are not going to break your installation.
Why Yii Framework?
The Yii Framework was chosen as a base framework because its components tie tightly together. It is very fast, clean, and has a strong community.
Before we started building Zurmo, we looked at Yii, Cakephp, Zend, and Codeigniter. Yii had a full set of functionality and matched up well with the other frameworks. We also liked the event driven architecture. Overall, we are delighted with the decision.
Why RedBeanPHP for ORM?
Although Yii is a solid PHP framework and fit the best to our requirements, we still have had to modify it heavily. Yii Active Record did not satisfy our database abstraction plan, so we decided to use the RedBeanPHP ORM system, which is a lightweight system.
It is not as popular as Doctrine or Propel, but it satisfies our needs. RedbeanPHP can work in two modes: unfrozen, where the database structure is not fixed, and frozen where the database structure cannot be changed.
During development, unfrozen mode should be used, and once the database development is done, the frozen model should be used. Frozen mode is much faster than unfrozen, so it should be used on production servers. With this approach, we just define the model's metadata and the table is created automatically.
How a Developer Benefits?
Zurmo can be used by anyone from a 1-person freelancer to a 100 user sales organization. As we build the feature set, it will become more and more geared towards larger, complex use cases, with many moving parts.
The more integrations, high volumes of data, and customizations, the better Zurmo is positioned to handle the use case. We aspire to be the first open source CRM that can scale to the enterprise.
Currently, we have a customer that uses Zurmo as the core system for centralizing millions of data points and running the company's entire operations. We also have a rugby team in the UK that uses Zurmo for activity management and sales force automation.
Gamification and social collaboration works better for larger user deployments, but individuals who simply need to manage their customer data and sales, marketing, and support processes can still benefit from the application.
Developing Your Applications on top of Zurmo
When it comes to developing an application, Zurmo can be used as a baseline platform, especially when needing to build a multi-relational database app. Many times a CRM system can be used as a starting point for building a custom app because the objects and relationships are already there.
For example, a non-profit organization that has 4,000 employees might use a CRM application to manage the health benefits for all workers. This is not a traditional CRM use case, but with some ingenuity, this application can be customized to fit the requirements.
The “contacts” module is re-purposed for internal “employees”. The “opportunities” module is re-used for the different “benefit plans”. Instead of building an application from scratch, a CRM can save time by simply re-purposing and customizing the existing out-of-box functionality.
With the testing infrastructure and software architecture of Zurmo, a developer can build a custom application that allows them to refactor and perform upgrades knowing there is a safety net in place. Less bugs. Less surprises. When developing on top of Zurmo, there is peace of mind.
... to read more articles, visit http://sqa.fyicenter.com/art/