July 2014 archive

Subscribe to new posts via outlook

If you want to get updates whenever new posts are added then you can subscribe to RSS feeds via Outlook. Right click ‘RSS Subscriptions’ and select ‘Add a new RSS Feed’.

The feed url is: http://buzz.trueclarity.co.uk/feed/

To promote the feed to make it more visible you can always make it a favourite within outlook.
outlook

Count versions of a Sitecore item

A quick sql script can find any big offenders:

Count items in a Sitecore folder

A quick sql script can find any big offenders:

Sitecore tree performance from IIS logs

If you want to find out average load times for eg how long nodes take to load use the following iis log query and then filter the data in excel:

See IIS Log parser for how to run these queries.

Powershell regex

If you need to parse some content, run a regex and then select the distinct results its all pretty simple in linq. How about powershell?

If you don’t want to target the specific group then simplify the match selection:

The neat thing here is using the | syntax you can easily distinct the list prior to writing to the file.

IE11, user agent sniffing vs feature detection

I recently found a bug in curvycorners.js and IE11 – curvycorners uses user agent sniffing to detect ie browsers by looking for the presence of ‘msie’. However the IE11 user agent has changed and become far more complicated to sniff! This blog explains the changes:

http://blogs.msdn.com/b/ieinternals/archive/2013/09/21/internet-explorer-11-user-agent-string-ua-string-sniffing-compatibility-with-gecko-webkit.aspx

User Agent sniffing seems to be a common way of detecting the browser and version in order to target code at certain browsers, however it is far from ideal. This blog gives a good overview of why it is not a good idea. It also give an overview of the alternative – feature detection

http://msdn.microsoft.com/en-us/library/ie/hh273397(v=vs.85).aspx

For a much more detailed blog on feature detection see:

http://msdn.microsoft.com/en-us/magazine/hh475813.aspx

 

Automating the cost calculator

I’m going to share a short example of how I automated the testing of recent piece of work and share a few tips on how to use Minion.

When I picked up this piece of work I was tasked with refactoring and updating a large area of code related to the UI, presentation and data access of a calculator widget. The internals were already heavily covered by unit tests – so I was happy I would not break any of the calculation logic, but I did need to be careful that I didn’t feed the wrong data into these various modules and that I hadn’t crossed any wires so to speak.

Of course there are a number of ways of doing this – code based integration tests are fantastic, but for this example I thought I’d write a quick browser based test. The idea is that if I capture inputs and outputs from a UI perspective before I make any changes to the code I can quick validate that I haven’t broken anything.

Below is a test script, executed by Minion to test the calculator.

I didn’t have any way to distinguish textboxes (no unique classes, and dynamically generated Id’s by asp.NET). To work round this Minion can gather a group of elements:

i.e .calculationForm input returns an array of 2 inputs.

I can specify an index to determine which input from the group I want Minion to use as its context element – easy.

Another tip is that you could also use jQuery to achieve the same effect. The code:

jQuery(‘.calculationForm input:eq(0)’)

Will do exactly the same thing.

MINION /hand-dryers/airblade-db/airblade-db.aspx

INPUT .calculationForm input 1 “1”
INPUT .calculationForm input 2 “1”
SELECT .calculationForm select @100
CLICK .calculationForm .goldBtn

VERIFY .savingValue 1 “£716.84″
OR VERIFY jQuery(‘.savingValue:eq(0)’) “£716.84″
VERIFY .savingValue 2 “£706.84″
VERIFY .savingValue 3 “£701.27″

1 2