Few things going on in Sitecore land?

Leave a comment

October 16, 2009 by Alistair Deneys

There’s a few things going on at the moment in the world of Sitecore.

Firstly the Sitecore Australian and New Zealand user group is having it’s second user group meeting, this time in Sydney Australia on 28th October 2009. Tim Ward, Solution Architect for Sitecore Australia will be taking attendees through some of the new features of Sitecore 6.1 and some of the up coming features of Sitecore 6.2. Mark Stanton from Gruden will also be speaking to the group. Everyone is welcome to attend this event, you just need to RSVP to Tim at tiw@sitecore.net so he can make sure he has enough beer. šŸ™‚ You can view the invitation online at http://img36.imageshack.us/img36/3907/usergroupinvite2.jpg .

Kind of in conjunction with the user group meeting, we’re also holding a Sitecore module competition. So if you’re in Australia or New Zealand and you have an awesome module you’d like to share with the world (and score a cool prize for it too) then make sure you get your entries in before 28th October 2009 to either Tim or myself.

And something that will interest more than just Sitecore devs in Australia and New Zealand, do you remember the Html Agility Pack? Sitecore bundles this library and I’ve spoken previously about how to use this library to aid in testing static behavior controls in Sitecore. Some of you may have looked for info on this module or found it’s CodePlex page and been turned off due to it’s lack of recent activity. Well, those days are now over.

Jeff Klawiter has picked up Html Agility Pack and started working on it again to fix bugs and add features which have been requested. So it is no longer an abandoned project. You can help Jeff out by telling him about how you use this library and if you’ve found any bugs, nuances or have feature requests. Kudos to Jeff for picking this project up. I look forward to seeing how it evolves.

So, just a little recap of why you should use Html Agility Pack for your testing. It allows you to easily load in HTML and treat it as XML, no matter what HTML standard it was written to. The earlier standards such as HTML 4.01 allowed you to leave off closing tags in some circumstances like on a paragraph. You can’t load HTML 4.01 into an XML document for testing as it’s not valid XML. But Html Agility Pack hides all that from you and just allows you to treat it as if it were XML.

But wouldn’t you want to know if your HTML was badly formed? Shouldn’t you be testing every single character of your control’s output? Well, that depends on how pedantic you want to get, and can even come down to which .net controls you may have used for your build. I would recommend against testing every single character as it doesn’t matter for (X)HTML. (X)HTML doesn’t care if you have a newline between a closing and separate opening tag, or you indented that tag too much. And how much time do you really have to spend on getting the output “character perfect”?

Instead I would suggest you treat any validation of control output as a separate activity in your test. You can use Html Agility Pack to test the markup as the browser would treat it and then you can test the conformity of the output to standards using something like HtmlTidy or the W3C validator .

And before you go jumping into vast string manipulation to verify your output, remember that it is much easier to navigate the structure of the document as XML. Especially when it comes to checking the value of an attribute on a tag. Rather than Substring and IndexOf I can just use XPath to find the attribute value.

Advertisements

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

Categories

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