Loading...
Skip to Content

Generating testable content in Episerver

An IInitializableModule for creating known testable content for QA/UAT acceptance

After recently starting working with Episerver. I have decided to try and put together a series of blog posts on the ways I am leveraging the features available in Episerver.

This post is going to be about how I use an Initializable Module to create consistent testable content. This will make developers lives easier, as they pick up the project will have a set of test pages to work with. They can also then be used by QA and UAT teams during their testing processes. I know that they will still need to create/delete/update test content, but giving them a head start by having known content seems like a good idea.

I have created a public repo with a very basic Episerver site, it has three simple page types, StartPage, ArticleList & Article. They are for creating some demo content. I haven't done any rendering/FE code, I am just focussing on generating content.

The key file to focus on is the CreateQaContentInitModule where (if a web.config value is set to true) a new StartPage, new ArticleList and 10 new articles are created.

For this example, I have used Bogus and Waffle, which I think most of the time will work, but other approaches could be reading content from JSON files/DB, etc.

UDPATE

After some feedback/discussion around this post IMigrationStep have also been highlighted as a way of acheiving something similar, they wouldn't replace the IInitializableModule, but could be useful in some use-cases.

Andy Blyth

Andy Blyth, an Optimizely MVP (OMVP) and Technical Architect at 26 DX with a keen interest in martial arts, occasionally ventures into blogging when memory serves.

 
Andy Blyth