GoPro Hero3 and the iPad

The GoPro Hero3 supports 64GB SD (SDXC) cards.  64GB SD cards come formatted with the exFAT format.  This works great with the GoPro Hero 3 until you want to connect the Hero3 to an iPad as the iPad doesn’t support exFAT yet.  You’ll get a message like “Contents Unavailable.  The connected storage media may be damaged” or “Contents not Available.  Cannot read the connected storage media.” Continue reading

MVC.NET 2 Breaking Changes

Breaking changes in MVC.NET 2 (aka ASP.NET MVC 2):

  • There is a change to the behaviour of the Model Binder.  In MVC.NET 1, when a string property had no value to be bound to it, the Model Binder would assign an empty string to the property.  In MVC.NET 2 the model binder will assign null instead.  This can cause many issues.  See http://brianreiter.org/2010/09/16/asp-net-mvc-2-0-undocumented-model-string-property-breaking-change/ for more info.  I’d recommend getting used to the new MVC.NET 2 behaviour instead of using ModelBinders.Binders.DefaultBinder to go back to the MVC.NET 1 behaviour.
  • By default you can no longer return JSON from an Action that accepts HTTP GETs.  This is with good reason and closes up some serious potential security holes.  If you understand the implications, you can bypass this restriction on a case-by-case basis using the new overload of the Json method: http://msdn.microsoft.com/en-us/library/ee430920.aspx

Assembly Version, Assembly File Version and Assembly Informational Version

.NET provides three assembly-level attributes for adding a version number to your .NET assembly:

[assembly: AssemblyVersionAttribute("1.0.0.0")]
[assembly: AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]

For the last few years I’ve often left the Assembly Version set to a fixed value (e.g. 1.0.0.0) and then set the AssemblyFileVersionAttribute to the something based on a CI build number (e.g. 2.0.0.272 for build 272).

For more info on the purpose of these assembly attributes see: http://all-things-pure.blogspot.co.uk/2009/09/assembly-version-file-version-product.html

You can retrieve the value of the Assembly File Version within code.  This can be useful for things like displaying a version number in your UI.  Here’s the code:

var assemblyFileVersion = (AssemblyFileVersionAttribute)Assembly
  .GetExecutingAssembly()
  .GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false)
  .Single();
return assemblyFileVersion.Version;

Behaviour Driven Development

I gave a “brown bag” talk on Behaviour Driven Design (BDD) this week.   I enjoyed the researching the content for the talk. Dan North’s couple of articles on BDD were really helpful: Introducing BDD and What’s in a Story?

It was interesting to see how BDD started as an evolution of Test Driven Development (TDD) but is now as much about stories, acceptance criteria and functional acceptance testing as it is about unit testing. Continue reading

C# Generic Singleton

Occasionally I find myself writing a small .NET assembly that’s going to be used across a number of difference applications where I can’t assume that any particular Dependency Injection library fill be available.  In those situations, I often need to implement some sort of singleton object.  It’s on those occasions that I turn to the following generic singleton class I created based on Jon Skeet’s singleton implementations.

Continue reading

Using WebDriver with CSharp

You can read my previous post if you’re interested in the background to this post. What follows is a step-by-step guide for using WebDriver from C# test code.

Preparation

What you’ll need:

  • IKVM.NET.  I used version 0.40.0.1 and the download was called ikvmbin-0.40.0.1.zip
  • WebDriver “all”.  The download will be called something like webdriver-all-7376.zip

Continue reading

Moving away from Selenium

Recently I’ve spent a lot of time developing MVC.NET based web apps. The automated functional tests for these web apps have all been written using Selenium, with the tests written in C#  and organized as NUnit test fixtures.

Whilst I found Selenium to be a good tool, I ran into some serious problems with it:

  1. Some of my Selenium based functional tests would fail approximately 10% of the time when they were run against Firefox.   Switching the exact same tests to using Internet Explorer (still with Selenium) resulted in the tests returning to 100% stability.  This meant abandoning automated functional testing with Firefox in favour of using IE.
  2. Slow performance in Internet Explorer (mitigated to some extent by switching the XPath engine Selenium uses with it).  IE just isn’t a fast browser when used with Selenium.
  3. Many of Seleniums operations are non-blocking (i.e. asynchronous).  This means Selenium doesn’t wait for those operations to complete before allowing a test to continue.  For example opening a new webpage in Selenium is a non-blocking operation; Selenium will happily load a page and then (via the next line in the functional test) attempt to click a button on the page when the button hasn’t even loaded yet.

Looking round for an alternative to Selenium, there was one obvious replacement: WebDriver.  Continue reading