codeflood logo

Coffee => Coder => Code

Ramblings on code, Sitecore and stuff

Automated Testing and Sitecore - Part 6

In this installment we'll cover testing the static behaviors and presentation of our other Sitecore presentation components; layouts, sublayouts and renderings. These components are more difficult to test as they need to be hosted inside a Sitecore page to allow testing them. Because these components will be hosted in a page, we will be making web requests to the server to get the page output,...

Make Sitecore host WCF

For a long time I've been a huge fan of .net remoting. Once you got your head around the architecture, it is a really nice technology to use when you need to make calls across applications. In the past I have done this straight out of Sitecore with no problems. The general scenario involves 2 Sitecore servers setup in a master / slave configuration where the master server is the content authoring...

Automated Testing and Sitecore - Part 5

In the last part of this series we started to write tests around code which uses the Sitecore API. These tests were run inside the NUnit custom test runner we wrote back in part 3 of this series. In this post, we'll start testing our presentation components, starting with the easiest to test, which is a Sitecore WebControl. This is any class which inherits from Sitecore.Web.UI.WebControl. The...

And Another One for Shared Source

Last night I uploaded the Quicklaunch toolbar which I created a few months ago into the Shared Source section of SDN. So hopefully more people will now be able to find it. You can check it out by following http://trac.sitecore.net/QuickLaunchToolbar/wiki. It is also listed on the SDN at http://sdn5.sitecore.net/Resources/Shared%20Source/Shell%20Extensions/Quick%20Launch%20Toolbar.aspx. You'll find...

Automated Testing and Sitecore - Part 4

So far in this series we have covered some of the theories and techniques required to automate testing of Sitecore components, creating a custom NUnit test runner which runs inside the Sitecore website and exposes the Sitecore context to the running tests and how to programmatically setup our test environment for repeatable testing against know content structures. In this post we are going to...

Automated Testing and Sitecore - Part 3

In my first post of this series I talked about the high level concepts of how I do my automated testing in Sitecore. All of the techniques I wrote about require a known content structure to test against as the content tree makes up one part of the input into our test. This post is going to focus on programatically setting up our test environment so we can perform our tests in a repeatable...

Into Shared Source

It is with great pride I today became part of the elite known as the Sitecore shared source contributors. How does one become part of such a privileged group? You just have to contribute something to the Sitecore shared source repository :) . I have placed one of my Sitecore tweaks, the Editor Line Numbers which I released on this blog a few months ago, into Sitecore shared source. I did this...

Automated Testing and Sitecore - Part 2

In the first post of this series I mention I make use of a custom NUnit test runner which runs in the Sitecore context. In this post I'll take you through creating such a test runner. The test runner is just a web form deployed to the webroot of your Sitecore site. Because it runs inside your Sitecore application it runs within a Sitecore context. The test runner allows running a selection of test...

Show some standard fields always

I had a question posed to me today from Krystle Magadia from New Zealand about how to show some of the standard fields without having to switch on standard fields under the view tab in the content editor. The scenario given was that the archive and reminder fields (under the tasks field section) should always be displayed. Normally we interact with these fields using the commands and wizards on...

Automated Testing and Sitecore - Part 1

Well, my last post seems to have generated some interest. Automated testing with Sitecore is a hot topic. It is much more difficult and complex than those 2 second demos you see for general unit testing in your code. The purpose of this post is to describe how I currently perform my automated testing against Sitecore. I say currently because I am constantly updating how I do this as I discover...

Damn you VSUnit!

I ran into quite an unusual quirk with VSUnit today. (I've taken to calling Visual Studio Unit Testing VSUnit for brevity.) I've been doing some Sitecore dev using Test Driven Development (TDD) which I have had great success with in the past when working in a purely NUnit space. But with VSUnit I like the ability to run my tests straight inside the IDE (please don't point me at TestDriven.net :)...

Source Control for my content

Sitecore already has version control built in for content. This is great when you're using the CMS to deliver content, but during implementation the benefit isn't as great. What would be really good, is if I could somehow utilise my existing source control software which I use for my developer files for the content as well. Ah, Sitecore 6.0. With it's wealth of new features and usability...

Creating and running custom pipelines in Sitecore

A lot of what happens when you request a page in Sitecore is handled by pipelines. Actually, Sitecore makes extensive use of pipelines all the way from handling page requests, to uploading files and saving items through the UI. So what is a pipeline? A pipeline is a discrete set of steps, executed in order. It is an architectural design you can employ for certain cases in your applications. If I...

Windows Command Bindings for Revolver

So, you may have guessed that I lean towards the *nix way of doing things with the command bindings in Revolver. I prefer ls over dir. But if you're writing code for Sitecore you're definatly working in a Windows environment and probably not so comfortable with the *nix commands. I've written Revolver to be extensible and also to allow the rebinding of the core commands to different monikers. This...

Sitecore as a Content Delivery Platform

Sitecore does a really good job of separating content from presentation. And a side effect of this is that we can reuse either part in other ways. We can reuse the content section of Sitecore to author and deliver content to different applications and we can reuse the presentation to generate markup for data which lives outside of Sitecore. This post is going to focus on the content side of...

XML serialization of read only properties

I was writing a service the other day where I wanted to marshal a custom class across the service boundary. This scenario starts off as a web service (no WCF here...at least not yet anyway). Now it's quite easy to marshal your own custom class across the web service server to the client...or so you would think. You end up with a class which looks like your class; it has the same properties, but...

Moving fields with Revolver

The Sitecore packager is a brilliant little application for moving things from one Sitecore server to another. One limitation I've run into with it is that it only operates on the item level. If I only need or want to update certain fields of an item, then I have to do it manually. Or so I did before Revolver anyway. Let me give you a solid example of what I'm talking about. When performing...

Line numbers in developer centre

Recently I was in a Sitecore training session where a student was commenting on the line numbers given in XSLT errors from .NET. As with most XSLT parsers, when the .NET XSLT parser encounters a syntax error in the XSLT file it gives a friendly error message including the line number the error occurred on. This particular student mentioned it would be good if the XSLT editor in Sitecore contained...

ASP.NET driving force behind .NET

Hmm. So what's this new category here? Observation / Opinion? Well, to distinguish the regular tech posts from my not-so-tech thoughts and discussions, I've created a new category on this blog. If you're only interested in the purely tech stuff, then you can ignore anything tagged in this category. Anyway, I just finished listening to dot net rocks episode 347 with John Lam, the guy behind...

Quick launch toolbar for Sitecore

One feature I find I can't live without in a windowed environment is the quicklaunch toolbar. This is the row of icons which sits next to the menu button. I just find it so handy to launch any commonly used application from there rather than clicking through the menu to look for it. And yes, we can also make use of desktop shortcuts, but to do that you have to minimise all your windows before...