November Happy Hour will be moved to Thursday December 5th.

Stefan Forsberg
Nov 15, 2010
  4150
(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
AsyncHelper can be considered harmful

.NET developers have been in the transition to move from synchronous APIs to asynchronous API. That was boosted a lot by await/async keyword of C#...

Quan Mai | Dec 4, 2024 | Syndicated blog

The search for dictionary key

Recently I helped to chase down a ghost (and you might be surprised to know that I, for most part, spend hours to be a ghostbuster, it could be fun...

Quan Mai | Dec 4, 2024 | Syndicated blog

Shared optimizely cart between non-optimizley front end site

E-commerce ecosystems often demand a seamless shopping experience where users can shop across multiple sites using a single cart. Sharing a cart...

PuneetGarg | Dec 3, 2024

CMS Core 12.22.0 delisted from Nuget feed

We have decided to delist version 12.22.0 of the CMS Core packages from our Nuget feed, following the discovery of a bug that affects rendering of...

Magnus Rahl | Dec 3, 2024