Tuesday 15 July 2014

How fast do the 'NUnit-Cassini-driven' tests execute (on a full TM instance)

A question I received after posting The moment I was able to serialize objects across an ASP.NET AppDomain and an NUnit AppDomain was 'Ok, that is is interesting, but how fast is it?'

That is actually one of the 'THE' key questions, since if we want to be able to create NUnit tests that use newly created Cassini-driven websites (i.e. a new Cassini server per test or test class) they have to be fast.

Ok, so how 'fast' is fast?

Well, in my book, that is either less than 1 second (for quick tests) or 10 seconds (for more complex setups).

More than that, and it is not practical to run those tests from NCrunch (or even manually via Resharper/NUnit-GUIs)

The good news is that (as you can see below), I was able to execute an 'NUnit-Cassini-driven' test in:
  • 6 sec: via NCrunch (consuming a TM instance with 0 libraries)
  • 7 sec: via ReSharper (consuming a TM instance with 3 libraries)
That, is the kind of speed that is needed :)

I'm not sure how much more I can shave off these timings, since there is the 'small matter' of a full ASP.NET stack (via cassini) being loaded in that time (which is something I don't have much control over).

Here is the UnitTest that was executed


Basically the code shown above (see gist here) is checking that we can get and modify the live TM's TMConfig object

Here are the execution timings of NCrunch:


Here are the execution timings of ReSharper:


To confirm that we did had a live instance of TM running, I added this to the end of the NUnit test


... which opened this window (when executed via NCrunch):


... and this window (when executed via Resharper)