Dreamcore AU 2011

8

October 6, 2011 by Alistair Deneys

It was my great pleasure to present at Sitecore’s Dreamcore event in Sydney, Australia this week. This was the first time the conference was held in Australia and it was fantastic with lots of great speakers and interesting people.

My session was titled “Testing Strategies for Sitecore” and was run in the developer stream, so it focused on automated/unit testing. As promised for everyone who attended my session, here is the code for my demo site and test project, as well as the slides.

The test project shows a few different techniques for automated testing your Sitecore projects including:

  • Testing pages over HTTP
  • Testing using a web browser driver (WatiN)
  • Instantiating a Sitecore control
  • Testing within the HTTP Context
  • Testing without an HTTP Context

I’ve covered all of the above techniques before, except for the last one, testing without an HTTP Context. I’ll cover that technique in detail in a future post.

Advertisements

8 thoughts on “Dreamcore AU 2011

  1. Nick Williams says:

    apparently there’s this secret feature in c# where you can write code against this thing called an “interface”. i hear it helps testability and decoupling components of a system? i’m slightly cynical of these bold claims, but maybe someone will whisper the secret in sitecore’s ear at some point, spurring them to investigate the validity of these claims.

    • Alistair Deneys says:

      It’s a shame I ran out of time in my session cause Tim Ward from Sitecore Australia was going to do a bit on the end of my session to tell us about the things coming in the next major version of Sitecore that will aid in testing. And it looks like Sitecore have been reading the same books you have. Interfaces, interfaces, interfaces. Of course I’ll fill you all in when I get more details…

  2. ko says:

    Thanks for putting up your code and slides, I got a lot out of your session and we’re looking and implementing this sort of stuff now within our org.

  3. KP says:

    Thanks for all you good bloggposts!
    I’ve tried using the XslFile.RenderAsText, but for some reason it do not output anything? Eventhough the items is created?

    How you tried that? The testrunner works and outputs:

    Expected string length 7 but was 0. Strings differ at index 0. Expected: “Child 2” But was: ———–^ at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args) at NUnit.Framework.Assert.AreEqual(Object expected, Object actual) at Netlab.Testing.Renderings.NavTest.InclusionAndName() in C:\Visual Studio 2010\Projects\Citify\Citify.no\Trunk\Citify.Website\Netlab.Testing\Renderings\NavTest.cs:line 60

    Suggestions?

    • Alistair Deneys says:

      Hi KP,
      Did you set the Sitecore.Context.Item property first so the rendering knew where to pull content from? To see if it’s a rendering or context issue, try outputting some static text from your rendering and see if that’s returned from the “RenderAsText” method.

  4. […] you’d like a working example of this technique you can refer to my materials from Dreamcore Australia 2011. I was lucky enough to recently deliver the same presentation to the Sitecore Users Virtual Group, […]

  5. kevinobee says:

    Alistair Deneys :
    It’s a shame I ran out of time in my session cause Tim Ward from Sitecore Australia was going to do a bit on the end of my session to tell us about the things coming in the next major version of Sitecore that will aid in testing. And it looks like Sitecore have been reading the same books you have. Interfaces, interfaces, interfaces. Of course I’ll fill you all in when I get more details…

    Do you have any update on forthcoming testing support in Sitecore?

    • Alistair Deneys says:

      Hi Kevin,
      All I’ve been told is lots of interfaces (IDatabase, IItem), so mocking will be a breeze and unit tests can be just that, “unit” tests and not integration tests.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The views expressed on this blog are solely my own and do not necessarily reflect the views of my employer.
%d bloggers like this: