Stefan Forsberg
Nov 15, 2010
  4092
(3 votes)

Making EPiServer code testable – the role of the community

As I mentioned briefly in my last post I don’t think EPiServer have been under a lot of pressure from the community to make the core product (unit) testable. And while it would be nice if this was top of the priority list at the development team it’s not very realistic. Given that this series of posts will focus on what can be done today and hopefully raise some awareness so that more people bug Epi about this topic.

Joel Abrahamsson, while most known for his absolutely despicable taste in choice of radio stations, has create a few frameworks under the umbrella of EPiAbstractions that makes testing easier. Inspired by this, I thought I ought to step up too and try to contribute something to the community. But first the disclaimer.

The Catch-22 of writing about unit testing

The big problem I find with writing about this topic is that there’s largely two groups of people. Those who knows about unit testing and how to apply it and those who don’t. It’s very easy to fall into the trap of writing something that says nothing new to those who already applies it and still seem totally alienating to those who don’t. To make it more interesting, many people who do understand testing see the test themselves as a bi-product of other means, like good architecture or as a way to drive the design.

Personally my view of tests have evolved from “something I must do because all the cool kids are doing it” via “omg, how can I test this httpcontext” followed by “ah, SOLID makes sense and how did I live without IoC-containers” to today where I view the test primarily as documentation and a driving force for my code.

My aim here is to just try and write something that I feel that I would have found useful or at least intriguing from around two and a half years back and forward. If you find it to your liking, great. Otherwise, sorry for wasting your time.

The plan

This is mostly just for me so that I know what I had originally planned as well as to put some pressure on me to actually write something.

1. A quick introduction to the tools we’re going to be using; NUnit, Moq and MSpec.

2. A discussion about different “patterns” and concrete tests to the fallback language method discussed in earlier posts.

3. Refactoring (some of) Fredrik Vigs extension library EPiCode.Extensions to be testable and also write tests for it.

4. A sample site written in EPiMVP and what the MVP pattern means for your testability. This will also be used for an introduction to web testing using Watin or Selenium.

Nov 15, 2010

Comments

Nov 15, 2010 04:45 PM

Absolutely superb idea Stefan. I'm really looking forward to your posts.

From what I know of the UK EPiServer community - most developers understand the need and benefits of unit testing but aren't up the stage where it is a habit to actually write the test before implementing any code. Largely this is because of the difficulties with writing robust and meaningful tests against the core EPiServer API.

Any light you can shed on this will be much appreciated.

Nov 15, 2010 09:18 PM

This is gonna be interesting. Looking forward to it as well.

Nov 16, 2010 11:58 AM

+1
Sounds really interesting.

Please login to comment.
Latest blogs
Opti ID overview

Opti ID allows you to log in once and switch between Optimizely products using Okta, Entra ID, or a local account. You can also manage all your use...

K Khan | Jul 26, 2024

Getting Started with Optimizely SaaS using Next.js Starter App - Extend a component - Part 3

This is the final part of our Optimizely SaaS CMS proof-of-concept (POC) blog series. In this post, we'll dive into extending a component within th...

Raghavendra Murthy | Jul 23, 2024 | Syndicated blog

Optimizely Graph – Faceting with Geta Categories

Overview As Optimizely Graph (and Content Cloud SaaS) makes its global debut, it is known that there are going to be some bugs and quirks. One of t...

Eric Markson | Jul 22, 2024 | Syndicated blog

Integration Bynder (DAM) with Optimizely

Bynder is a comprehensive digital asset management (DAM) platform that enables businesses to efficiently manage, store, organize, and share their...

Sanjay Kumar | Jul 22, 2024