Friday, 31 December 2010

WCF fully qualified type gotcha

It got me again, so I'm blogging it in the hope that I remember next time! When specifying fully qualified type names in .NET configuration files make sure to put a space after the comma that separates the parts(highlighted in yellow below).
   
<extensions>
<behaviorExtensions>
<add name="federatedServiceHostConfiguration" type="Microsoft.IdentityModel.Configuration.ConfigureServiceHostBehaviorExtensionElement, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</behaviorExtensions>
</extensions>
</pre></code>

Thursday, 21 October 2010

Ruby on Rails : uninitialized constant Test::Unit::TestSuite

I'm working on a side-project to learn how to work Ruby on Rails using the tutorial written by Michael Hartl to guide me. I think it is an excellent reference and would thoroughly recommend it. Anyway, the reason for this post is to supply the fix for a problem that held me up for a while in the hope that it might save someone else some pain. For reasons too laborious to go into I ended up with the following error when trying to run my RSpec tests after upgrading to Ruby 1.9.2.

/Users/gbarrs/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in `rescue in load_missing_constant': uninitialized constant Test::Unit::TestSuite (NameError)

The fix in my case was to add the the following 'require' statement to the rb spec file causing the error.

require 'test/unit/testsuite'

I have no idea why this line was required when the tests had been working perfectly well before the upgrade without it. I suspect some dependency versioning issue but I can't be sure. Anyway, the fix worked for me and it may work for you.

Wednesday, 21 July 2010

HTTP Modules In IIS 7

The entry for adding a HTTP Module in web.config has changed in IIS7.


Prior to IIS 7 a web config entry might look like

<system.web>

<httpModules>

<add name="startupModule" type="My.SuperHttpModule, My" />

</httpModules>

</system.web>

When using IIS 7 the entry moves from system.web to system.webServer and its name changes from httpModules to modules. A web .config entry might now look like

<system.webServer>

<modules runAllManagedModulesForAllRequests="true">

<add name="startupModule" type="My.SuperHttpModule, My" />

</modules>

</system.webServer>


Friday, 4 June 2010

The Arrangement Of Tests

I just read a post by Uncle Bob on Stack Overflow and wanted to remember a section on the arrangement of tests. So I posted it here.

Tests should be arranged as follows:

  • Unit tests provide close to 100% code coverage. They test independent units. They are written by programmers using the programming language of the system.
  • Component tests cover ~50% of the system. They are written by business analysts and QA. They are written in a language like FitNesse, Selenium, Cucumber, etc. They test whole components, not individual units. They test primarily happy path cases and some highly visible unhappy path cases.
  • Integration tests cover ~20% of the system. They tests small assemblies of components as opposed to the whole system. Also written in FitNesse/Selenium/Cucumber etc. Written by architects.
  • System tests cover ~10% of the system. They test the whole system integrated together. Again they are written in FitNesse/Selenium/Cucumber etc. Written by architects.
  • Exploratory manual tests. (See James Bach) These tests are manual but not scripted. They employ human ingenuity and creativity.

Thursday, 25 February 2010

Lessons learned from NHProf

I went to another Skillsmatter event last night where Ayende was taking about some of the lessons learned from building NHProf. The points that stuck in my mind were:



* Every build goes straight to release



* Sometimes Not Invented Here is fine.



This led me to think about some other things:



* Think about the application you are building. If it's not an enterprise application the do you really need to apply enterprise patterns. I'm not saying "don't". I'm just saying think about what is appropriate for your situation.



* Ayende built his own build server. Is it appropriate for you to do the same? It depends :-) The reason that many people use things like Cruise Control, Team City etc is because they are well known tools. In companies where employees come and go the use of these standard tools means that new employees already know how these things work and can concentrate on learning the business stuff rather than the supporting infrastructure.



As an aside, Skillsmatter are doing a special rate of £75 until Sunday 28th Feb for their 3 day tutorials event. I attended this last year and I thought it provided good value for money. See their site for details.