mei 04, 2016
As an enterprise platform, the Sitecore Experience Platform provides a wide range of functionality. With such a wide ranging set of functionality the testing of any custom configuration or code can - at first glance - be a daunting task. In this post we highlight several methods and tools that will allow development teams to lower the cost of development while ensuring a high level of quality and happy users.
Let’s begin with some of the tools you will need:
- Continuous integration. We like Team City (from JetBrains) and Team Build (Microsoft) but you can pick from almost anything on the market.
- Team Development for Sitecore. Source control Sitecore items, manage deployment packages, code generation and so much more.
- PowerShell. Anyone tackling automation on the Windows platform needs PowerShell. When dealing with Sitecore you will probably want TFS PowerTools for the additional snappins. WebAdministration and SQLPS are also valuable.
- Sitecore Instance Manager (SIM). SIM allows for management of Sitecore installations and includes an API.
- PowerShell for Sitecore. Brings the power of PowerShell to Sitecore. A killer module on the marketplace: https://marketplace.sitecore.net/en/Modules/Sitecore_PowerShell_console.aspx.
- Development Accelerator. If you are building everything from scratch, stop. Consider a development accelerator like Nonlinear’s Keystone for Sitecore to drastically cut development costs.
- Web Drivers / Integration Tests. Selenium, PhantonJS are our favourites, but any tool that can let you drive a web browser is invaluable for integration and regression testing of Sitecore websites and the Sitecore Experience Editor.
1. Building the Automation Suite
When you take all of these tools and combine them into an automation suite you can realize large time savings but just as importantly become more predictable. Here are some of our top considerations for automation:
Setting up Sitecore Environments.
As a part of good development practices you will want a continuous integration (CI) environment, quality assurance (QA), and Pre-Production environment. If your production environment is scaled, we would also recommend that the CI, QA and Pre-Prod environments are also scaled for at least management and delivery. That is a lot of non-production Sitecore installations to manage.
This is where Sitecore Instance Manager or PowerShell can be very useful. If you need to set these environments up once and then forget about it, SIM is probably the way to go. But if your solution demands a complete tear down of environments to vet deployments you may want to consider PowerShell. The same would go for large teams that are sharing code across environments or versions of Sitecore – PowerShell’s flexibility wins out.
An excellent starting point for PowerShell scripted install of Sitecore is Patrick Perrone’s example on GitHub. The script can read configuration from an XML file and provision Sitecore 8.0/8.1 including specific configuration and hardening steps for roles. In my local development environment, I use a variation of these scripts extensively to tear down and rebuild environments to test deployment procedures to clean installations.
Time required to setup: less than one day
Worth investing when: Your environment is scaled, you want to cut downtime for production deployments, the access to resources (people) to install Sitecore environments is limited.
2. Continuous Integration
There are many tools that allow a team to check-in code and run automated builds. TeamCity, Jenkins and Team Build seem to be what we encounter most often. To really get the most out of your CI process, you might also consider Team Development for Sitecore or one of the open source tools that provide a sub-set of the functionality: Unicorn and Sitecore Courier.
Time required to setup: TeamCity install takes 30 minutes, setting up build configurations should take less than 1 day (assuming solution is built to be deployable)
Worth investing when: Always. Even if you only have a single developer on a project, the CI process ensures that check-ins are complete and is a good first gate to ensure solution changes will be deployable to production. Early QA is much cheaper.
3. Integration Testing
Using tools like Selenium or PhantomJS to build test suites for the website or the Experience Editor interface are invaluable time savers. As changes are rolled out these automated scripts can detect errors caused by new functionality or deployment.
We have setup our tests such that the result of the last run (i.e. before deployment of changes) can be compared to the most recent run. This provides a very cost effective means to assess the actual changes in the site(s) after a deployment or upgrade.
What we test for:
- Web accessibility
- Experience Editor functionality: adding or removing components, personalization, optimization (A/B testing)
- Expected HTML tags / CSS classes
- Visual display by comparing before and after screen shots
- This includes screen shots at different resolutions to test responsive design
Time required to setup: 5 days would be a typical starting point, varies heavily based on the solution
Worth investing when: you plan to make regular ongoing changes to the site, your Sitecore installation hosts multiple sites that may be impacted by updates to one or more of the sites
Automated environment creation, continuous integration and integration testing can provide quick returns for relatively low investment.