Earlier this week I released two blog posts on automated testing for Tridion templates. The idea to blog about this subject came from this stack overflow thread where several members from the Tridion community were discussing automated testing for Tridion templates. The technical solutions I offered in my last blog post each have their specific limitations. A post on the before mentioned thread by Nuno Linhares triggered my interest. He mentioned a web service that the template builder uses to debug templates.
After some research it turns out this web service is a really solution to achieve automated testing for templates. In essence, you feed the web service some basic data, the template is executed and the package with its content is returned to you. The whole solution was easy to setup, I created a demo solution to share with the community. All you have to do is add the reference to the service and you’re good to go. Check the config file for the service definition location on the Tridion content management machine.
Implementing automated testing this way has to following advantages and limitations:
Advantages: This solution is quite easy to setup and be used right away since it does not require any changes to the existing templates. Since we use a web service provided by Tridion there we can be sure the output is reliable.
Limitations: This solution only enables automated testing for complete template building blocks or templates. Testing individual functions within a template building block is not possible with this solution alone.
This approach is a very pragmatic way to test Tridion templates. Normally I would be put off by the fact that individual functions cannot be tested. But since template are data transformations making assertions on the output is pretty much all you need.
Using the same web service as the template builder turned out to be a very sweet deal. I wonder why Tridion doesn’t document and offer this solution as a way to automate testing for templates. I would be happy to write a more detailed article plus a demo project for the Tridion world platform if I was asked