April 2009 - Posts

My NxtGen tour in August
Wed, Apr 29 2009 10:06

I will be speaking on developer testing of SharePoint projects using Typemock at both the Birmingham and Manchester NXtGen user groups in August.

For more details check the NxtGen site.

Licensing exception with Ivonna the Typemock add-in (and any other add-ins I suspect)
Sat, Apr 25 2009 13:51

Like a good developer I have been trying to run Visual Studio with least privilege; with Windows 7 this seems to work well. My main account is not an administrator, but Windows prompts me for elevated rights when needed. I have been developing happily with Visual Studio and Typemock without any need for extra rights.

However, when I have been doing some testing using Ivonna, the Typemock add-in, I hit a problem. When I tried to create an Ivonna.Framework.TestSession() I got a Licensing.LicenseException: This copy has expired. Which it hadn’t as I have a fully licensed product.

I had got so use to not needing elevated privilege I did not consider it to be the problem; so I contacted Sm-Art and Typemock support. The answer was simply to run Visual Studio with administrator privileges (right click on the short cut). Once this is done the licensing exception goes away as Typemock has enough rights to look in the right bit of the registry to access the add-in license. I have suggested that if possible this requirement needs to be addressed.

The other alternative is to grant your non administrator account more rights in the registry. On a 64bit development box it seems you need to a Read-Write access to HKEY_LOCAL_MACHINE\SOFTWARE\TypeMock and HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\TypeMock

System.Web.Abstractions missing on a ASP.NET web site
Fri, Apr 24 2009 3:55

I recently re-enabled feature on a ASP.NET site. This feature (a set of pages) had been running OK about six months ago for an initial pilot project but was disabled until now until a decision was made to develop the feature fully. In intervening time the web site had other modification and had been rebuilt (it was targeted at .NET 3.5) without issue.

When I re-enabled the feature (renamed a .ASPX file) I got the error

Could not load file or assembly 'System.Web.Abstractions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Now this surprised me, I had not change the .NET version targeting or changed development environment. In the end I fixed it by copying up the missing DLL to the bin directory. I had tried adding the following to the web.config to no effect

  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <assemblyIdentity name="System.Web.Abstractions" publicKeyToken="31BF3856AD364E35"/>
    <bindingRedirect oldVersion="" newVersion=""/>

On think a bit more I think the issue must have been caused by:

  • I may have upgraded to .NET to 3.5. SP1 in the time frame (but I thought I did it earlier)
  • I have installed MVC on my development PC, and most other posts that mention this issue also mention MVC, usually beta versions.

EIther way it is fixed now

Follow up to my session yesterday at VBug Newcatsle on DataDude GDR
Thu, Apr 23 2009 4:30

Thanks to everyone who attended my session at VBug Newcastle last night, hope you enjoyed.

As I mentioned in my session, to celebrate my talking at VBug, Microsoft chose to release the Visual Studio Team System 2008 Database Edition GDR R2 yesterday. If you are using DataDude you do need to get this installed, it addresses many know issues.

Speaking in Newcastle tomorrow
Tue, Apr 21 2009 8:30

If you are in Newcastle on the evening of the 22nd I will be speaking at Vbug on Visual Studio 2008 Database Edition.

Hope to see you there.

Next Agile Yorkshire Meeting – Exploratory Testing
Sat, Apr 18 2009 16:34

Next months Agile Yorkshire meeting is on the 13th May where Ralph Williams will be talking about Exploratory Testing, the session outline sound interesting.

Alt.Net ‘In the north’ – wrapping it all up
Sat, Apr 18 2009 16:10

Thanks to everyone who was able to attend the Alt.net ‘In the North’ conference today; and also to our sponsors. The event could not happened without you all.

As promised here is the list of blogs, books etc. we had on the whiteboard.

Bridging the Communication Gap: Specification by Example and Agile Acceptance Testing Gojko Adzic
User Stories Applied: For Agile Software Development (Addison Wesley Signature Series) by Mike Cohn
Agile Estimating and Planning by Mike Cohn
Crystal Clear: A Human-Powered Methodology for Small Teams by Alistair Cockburn
Domain-driven Design: Tackling Complexity in the Heart of Software by Eric Evans
Sketching User Experiences: Getting the Design Right and the Right Design by Bill Buxton

http://weblogs.asp.net/scottgu/ (Scott Guthrie)
http://www.hanselman.com/blog/ (Scott Hanselman)
http://ayende.com/ (Oren Eini)
http://mattberseth.com/ (Matt Berseth)
http://oakleafblog.blogspot.com/ (Roger Jennings)

http://openspacecode.com – Coding events in London, next one 30th May
http://www.developerdayscotland.com/ - Free community conference in Glasgow 2nd May
http://www.agileyorkshire.org/ - Agile Yorkshire user group meets in Leeds every 2nd Wednesday in month
http://www.blackmarble.co.uk/events - Various free events in Leeds/Bradford area

http://www.hanselman.com/blog/ScottHanselmans2007UltimateDeveloperAndPowerUsersToolListForWindows.aspx - Tool list
http://www.balsamiq.com/products/mockups/desktop - UI Sketch tool
www.openquarters.org (coming soon) the MVC CMS that Anthony demonstrated at the conference
and a digital camera to capture your whiteboard drawings

I think that is all, thanks again to you all for making it such an rewarding event.

Technorati Tags:
Alt.net ‘In the North’ starts tonight
Fri, Apr 17 2009 6:49

Looking forward to seeing everyone at Alt.Net ‘in the North’ over the next two days.

If you cannot make the planning session tonight, but are in Bradford later, we will be in the Titus Salt Pub for a few drinks sponsored by SEED software. We will probably be upstairs from about 8:30pm

Technorati Tags:
Team Build, Code Coverage and MVC
Wed, Apr 15 2009 12:12

I have been working on some automated build and testing for a project based on the Microsoft MVC framework. The build was working fine, and test were being run, but I was not seeing any code coverage data in the build summary in Visual Studio for the builds done by the Team Build box. However if I ran the test suite locally on a development PC the coverage data was there. Looking on the Team Build drop location I could find the data.coverage file in the TestResults\<guid>\In\<build user> folder, but it was 84Kb in size, which I learnt means ‘contains no data’.

After a good deal of hunting I found a pointer to the answer the OZTFS forum. The problem is that as the MVC project is a web project, and it build a _PublishedWebsites folder and puts the assemblies into this. In effect the code coverage is just looking in the wrong place.

The fix is as follows:

  • Make sure you have suitable TestRunConfig1.testrunconfig file in your solution
  • Open this file in the VS IDE and make sure code coverage is enabled for the assemblies you want (and if your assemblies are signed that the re-sign key is set)
  • Open you tfsbuild.proj file for the automated team build and make sure you have a testing block similar to the block below, change the path to the RunConfigFile as required.

TESTING Set this flag to enable/disable running tests as a post-compilation build step.
CODE ANALYSIS Set this property to enable/disable running code analysis. Valid values for this property are
Default, Always and Never.
Default - Perform code analysis as per the individual project settings
Always - Always perform code analysis irrespective of project settings
Never - Never perform code analysis irrespective of project settings

CODE COVERAGE Set the test run configuration

  • If you test this locally you should get code coverage results, but if you run the build on a Team Build box the code coverage section in the test report will show "No coverage result"
  • Now the important bit – open the TestRunConfig1.testrunconfig file in Notepad and add an extra block to the <regular> code coverage section to additionally point to the assembly(s) in the _PublishedWebsites structure (you could also use the VS IDE on the build box to add the file if you wanted, but this will warn over an assembly being added twice). When complete the XML file should look similar to the one below
<?xml version="1.0" encoding="UTF-8"?>
<TestRunConfiguration name="TestRunConfig1" id="b6360bec-8278-4773-a931-f22bfab2c57f" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
<Description>This is a default test run configuration for a local test run.</Description>
<CodeCoverage enabled="true" keyFile="MyWebsite\ProjectKey.snk">
<AspNetCodeCoverageItem id="88655819-3261-43ac-b2d8-2d3aa1aabaef" name="MyWebsite" applicationRoot="/" url="http://localhost:0/" />
<CodeCoverageItem binaryFile="C:\builds\MyWebsite\CIBuild\Binaries\Release\_PublishedWebsites\MyWebsite\bin\MyWebsite.dll" pdbFile="C:\builds\MyWebsite\CIBuild\Binaries\Release\_PublishedWebsites\MyWebsite\bin\MyWebsite.pdb" instrumentInPlace="true" />
<WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207">
<Browser name="Internet Explorer 7.0">
<Header name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" />
<Header name="Accept" value="*/*" />
<Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
<Header name="Accept-Encoding" value="GZIP" />
<Network Name="LAN" BandwidthInKbps="0" />

  • Once this is done you can run the tests locally or on the build machine and in both cases MSTest manages to find the assembly to test the code coverage on and reports the results.
Holiday is when you catch up…..
Fri, Apr 10 2009 9:22

I got round to listening to the latest Radio TFS podcast today whist our for a run, Adopting Team System with Steve Borg. If you are looking at adopting TFS or even just critically looking at your development life cycle with a view to improving (irrespective of the tools you use), then this podcast is well worth the time to listen to. It actually covers a lot of the points I was discussing at the Agile Yorkshire user group this week in my session of Crystal Clear. By now I would usually have put my slide stack up for all to download, but in this case, as my session was a book review in essence I would like you to read the original Crystal Clear by Alistair Cockburn.

In my opinion, the key point they both raise is the that it is important to have a process that provides:

  • Safety – provides a framework that means the project can safely be delivered
  • Efficiency – development should be in an efficient manner
  • Habitable – that the team can live with the process (if they can’t the process will be avoided/subverted)

Or to put it another way (and quoting here from the Crystal Clear book) “a little methodology does a lot of good, after that weight is costly”

A point raised at the user group in the chat after my session was that of how to get senior people (such as CEO, CFO etc) to buy into the ‘new’ development process (a critical factor for success). Too often it is heard “I don’t care if you are agile or not, I just want it delivered” and no support is provided beyond the actual coding team from the business. A good discussion of this type of problem is in Gojko Adzic’s book Bridging the Communication Gap: Specification by Example and Agile Acceptance Testing. This is written for non software developers and discusses how to make sure that the whole business is involved in the development process, thus enabling the project to deliver what the business really needs not what people think they need. I would say this book is an essential for anyone involved in the software specifications process – and that should be everyone in an agile project!

Testing SharePoint Workflows using TypeMock Isolator (Part 3)
Tue, Apr 7 2009 10:42

Now I can test a basic workflow it soon becomes obvious that you could end up with many tests for a single workflow, as a workflow can have any number of criteria that could cause branching to occur. Maybe a sensible way to write the tests is using Fit/Fitness to provide the test cases in tabular form?

So to this end I have added a bit more code to my Typemock/Sharepoint test project (after installing the Fit libraries as detailed in my previous posts). I now have a single test that loads a set of test criteria from an HTML file (my previous posts discuss why I am using HTML files as opposed to the Fit Wiki).

   1: [TestMethod]
   2:      public void WorkFlow1SwitchOnTitle_DataViaFitnesse_Success()
   3:      {
   4:          fit.Runner.FolderRunner runner = new fit.Runner.FolderRunner(new fit.Runner.ConsoleReporter());
   5:          var errorCount = runner.Run(new string[] {
   6:                  "-i",@"WorkflowTestCases.htm", // the htm file that holds the test
   7:                  "-a",@"TestProject.dll",  //we have the fit facade in this assembly
   8:                  "-o",@"results"}); // the directory the results are dumped into as HTML
   9:          // fit can fail silently giving no failures as no test are run, so check for exceptions
  10:          Assert.AreEqual(false, Regex.IsMatch(runner.Results, "^0.+?0.+?0.+?0.+?$"), "No tests appear to have been run");
  11:          // look for expected errors
  12:          Assert.AreEqual(0, errorCount, runner.Results);
  14:      }

I then have an HTML file that contains the test cases (remember to make sure that this file is deployed to the output directory)

   1: <HTML><HEAD>
   2:     <body>
   3: <table border="1" cellspacing="0">
   4: <tr><td>import</td>
   5: </tr>
   6: <tr><td>TestProject</td>
   7: </tr>
   8: </table>
  10: <table border="1" cellspacing="0">
  11: <tr><td colspan="2">Workflow Fit Tests</td>
  12: </tr>
  13: <tr><td>Upload Document With Title </td>
  14: <td>Document Approved?</td>
  15: </tr>
  16: <tr><td>ABC</td>
  17: <td>True</td>
  18: </tr>
  19: <tr><td>XYZ</td>
  20: <td>False</td>
  21: </tr>
  22: <tr><td>abc</td>
  23: <td>True</td>
  24: </tr>
  25: </table>
  27:     </body>
  28: </html>

Finally we need to create the facade class that wrapper the workflow function for Fit to call. In this sample I just popped the class in the test project for simplicity. Notice it is this facade class that contains all the Typemock bits, also that I make use of the helper class I created in my previous post to actually run the workflow.

   1: using System;
   2: using TypeMock.ArrangeActAssert;
   3: using Microsoft.SharePoint.Workflow;
   5: namespace TestProject
   6: {
   7:     public class WorkflowFitTests : fit.ColumnFixture
   8:     {
   9:         public string UploadDocumentWithTitle;
  11:         public bool DocumentApproved()
  12:         {
  14:             var fakeProperties = Isolate.Fake.Instance<SPWorkflowActivationProperties>();
  15:             var fakeItem = fakeProperties.Item;
  16:             Isolate.WhenCalled(() => fakeItem.Title).WillReturn(this.UploadDocumentWithTitle);
  18:             // Act
  19:             TypemockWorkflowTests.WorkflowRunner(typeof(SharePointWorkflow.Workflow1), fakeProperties);
  21:             // Assert, if a document is approved must call the following two line
  22:             try
  23:             {
  24:                 Isolate.Verify.WasCalledWithExactArguments(() => fakeItem.Update());
  25:                 Isolate.Verify.WasCalledWithExactArguments(() => fakeItem["Approved"] = "True");
  26:                 return true; // we called all the updates expected
  27:             }
  28:             catch (TypeMock.VerifyException)
  29:             {
  30:                 // it did not call something expected, check if it was just the not approved path
  31:                 Isolate.Verify.WasNotCalled(() => fakeItem.Update());
  32:                 return false;
  33:             }
  35:         }
  36:     }
  37: }

I am currently working on a sample of this testing technique, that does a bit more than a simple branch on if test, I will post a set of sample code when I am done.

Visual Studio 2008 DBPRO GDR QFE (wow loads of TLAs there)
Tue, Apr 7 2009 4:48

At my session at SQLBits IV on Visual Studio 2008 DBPro GDR it was mentioned that there was a major patch just about to be released to address some known issues. Well Brian Harry has provided links to the release of the release candidate of the GDR QFE

Testing SharePoint Workflows using TypeMock Isolator (Part 2)
Mon, Apr 6 2009 16:48

After reading Gil’s blog on writing simpler tests I have done some tidying of the code from my previous post. In this version I have extracted the boiler plate code to run the workflow to a static helper method and modified my tests to incorporate Gil’s comments, they are certainly more readable.

   1: [TestMethod]
   2:       public void WorkFlowSwitchOnTitle_TitleStartsWithA_SetApprovelFieldAndUpdate()
   3:       {
   4:           // Arrange
   5:           var fakeProperties = Isolate.Fake.Instance<SPWorkflowActivationProperties>();
   6:           var fakeItem = fakeProperties.Item;
   7:           Isolate.WhenCalled(() => fakeItem.Title).WillReturn("ABC");
   9:           // we actually don't need to create this field MOSS lets us attempt to write to
  10:           // it even if not declared, it would only need to be created if we check the value in the workflow
  11:           /*
  12:           var fakeField = fakeItem.Fields["Approved"];
  13:           fakeField.DefaultValue = false.ToString();
  14:           */
  16:           // Act
  17:           WorkflowRunner(typeof(SharePointWorkflow.Workflow1),fakeProperties);
  19:           // Assert
  20:           Isolate.Verify.WasCalledWithExactArguments(() => fakeItem.Update());
  21:           Isolate.Verify.WasCalledWithExactArguments(() => fakeItem["Approved"] = "True");
  23:       }
  25:       [TestMethod]
  26:       public void WorkFlowSwitchOnTitle_TitleStartsWithZ_DoNothing()
  27:       {
  28:           // Arrange
  29:           var fakeProperties = Isolate.Fake.Instance<SPWorkflowActivationProperties>();
  30:           var fakeItem = fakeProperties.Item;
  31:           Isolate.WhenCalled(() => fakeItem.Title).WillReturn("XYZ");
  33:           // Act
  34:           WorkflowRunner(typeof(SharePointWorkflow.Workflow1),fakeProperties);
  36:           // Assert
  37:           Isolate.Verify.WasNotCalled(() => fakeItem.Update());
  39:       }
  43:       /// <summary>
  44:       /// A helper method to run a workflow for a test
  45:       /// </summary>
  46:       /// <param name="wfType">The type of workflow to create</param>
  47:       /// <param name="fakeProperties">The fake properties used to create the workflow</param>
  48:       private static void WorkflowRunner(Type wfType, SPWorkflowActivationProperties fakeProperties)
  49:       {
  50:           using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
  51:           {
  52:               AutoResetEvent waitHandle = new AutoResetEvent(false);
  53:               workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e)
  54:               {
  55:                   // don't put asserts here as will be in the wrong thread
  56:                   waitHandle.Set();
  57:               };
  59:               workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e)
  60:               {
  61:                   // don't put asserts here as will be in the wrong thread
  62:                   waitHandle.Set();
  63:               };
  65:               // when this is called the constructor is called twice
  66:               // the first time is for validation for the workflow in this appdomain see http://odetocode.com/Blogs/scott/archive/2006/03/30/3192.aspx
  67:               // then the real construction is run, the problem is this double run means that the Isolate.Swap.NextInstance
  68:               // fails as it attaches to the first validation create, not the second real one
  69:               WorkflowInstance instance = workflowRuntime.CreateWorkflow(wfType);
  71:               // SO for this reason we only get the swap after the first create has beend one
  72:               Isolate.Swap.NextInstance<SPWorkflowActivationProperties>().With(fakeProperties);
  74:               // we then recreate the workflow again, this time it has already been validated so
  75:               // so the swap works
  76:               instance = workflowRuntime.CreateWorkflow(wfType);
  78:               instance.Start();
  80:               waitHandle.WaitOne();
  82:               // the workflow is finished assert could go here, but will be done
  83:               // in the calling method
  85:           }
  87:       }

The workflow remains the same as in the previous post.

Speaking next week at Agile Yorkshire
Sat, Apr 4 2009 4:45

I am speaking in Wednesday the 8th at Agile Yorkshire, on Crystal Clear and lessons learnt in Agile projects. The user group is meeting at the Victoria Hotel in Leeds as usual, and thanks to our sponsors there is a free drink for all attendees.

Hope to see you there.

Live Writer crashing when adding hyperlinks
Fri, Apr 3 2009 16:52

For a while I have had a problem that when I tried to add a hyperlink via the toolbar in Live Writer I get a dialog that Live Writer has stopped working, it doesn’t exit, it just des not open the modal window for adding a hyperlink. It was irritating, but as I could edit the HTML source and put in the link by hand I could not be bothered to work out how to fix it.

Well today I wanted to add a new pluggin to Live Writer and it seem the options dialog suffers the same problem, so I had to fix it. I searched with Microsoft Live Search and it found nothing, so I tried with Google and found the solution on Tom Soisoonthorn’s blog , it is missing text in linkglossary.xml file.

Beyond the fact that this fixed my problems, it is interesting to note this is the first time a good few months where I have not found what I wanted via Live Search – it is much improved, but Google still seems to get just that bit more.

Testing SharePoint Workflows using TypeMock Isolator
Fri, Apr 3 2009 11:28

I have for a while been trying to test SharePoint workflows using TypeMock Isolator to mock out the SharePoint fixtures, I want to remove the dependency of having SharePoint on any test boxes where possible. I have at last got this working after getting a new version of TypeMock Isolator 5.3.0 + a fix from the very helpful team at TypeMock

My idea was to be able to build a workflow that could changed list item properties for a document e.g. the workflow could set a field called approved to true if certain criteria were met. Now as a MOSS2007 workflow is based on .NET WF I knew I could try to build upon the work I document in my previous post on TDD for WF.

My test system was as follows:

  1. I created a new SharePoint workflow, all it contained was a decision box that went down the true path if the document associated with the workflow has a title starting with the letter A
  2. In a coded action for the true path, I then set an approved property to true.

All very simple, but good enough for this test, the key methods are shown below

    private void IfTest(object sender, ConditionalEventArgs e)
       var currentItem = workflowProperties.Item; 
e.Result = currentItem.Title.StartsWith("A"); } private void TrueTask(object sender, EventArgs e) { var currentItem = workflowProperties.Item; currentItem["Approved"] = true.ToString(); currentItem.Update(); }

I then created a test using the same form I did for WF based testing, I think the comments cover the key points

        public void WorkFlowSwitchOnTitle_TitleStartsWithA_SetApprovelField()
            using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())

                // Create our fake workflow and items
                var fakeProperties = Isolate.Fake.Instance<SPWorkflowActivationProperties>(Members.ReturnRecursiveFakes);
                var fakeItem = Isolate.Fake.Instance<SPListItem>(Members.ReturnRecursiveFakes);

                var fakeField = Isolate.Fake.Instance<SPField>(Members.ReturnRecursiveFakes);
                fakeField.DefaultValue = false.ToString();
                Isolate.WhenCalled(() => fakeProperties.Item).WillReturn(fakeItem);
// setup the if test Isolate.WhenCalled(() => fakeItem.Title).WillReturn("ABC"); Isolate.WhenCalled(() => fakeItem["Approved"]).WillReturn(fakeField); // setup the workflow handling
AutoResetEvent waitHandle = new AutoResetEvent(false); workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) { // don't put asserts here as will be in the wrong thread waitHandle.Set(); }; workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e) { // don't put asserts here as will be in the wrong thread waitHandle.Set(); }; // when this is called the constructor is called twice // the first time is for validation for the workflow in this appdomain see http://odetocode.com/Blogs/scott/archive/2006/03/30/3192.aspx // then the real construction is run, the problem is this double run means that the Isolate.Swap.NextInstance // fails as it attaches to the first validation create, not the second real one WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(SharePointWorkflow.Workflow1)); // SO for this reason we only get the swap after the first create has been done Isolate.Swap.NextInstance<SPWorkflowActivationProperties>().With(fakeProperties); // we then recreate the workflow again, this time it has already been validated so // the swap works instance = workflowRuntime.CreateWorkflow(typeof(SharePointWorkflow.Workflow1)); instance.Start(); waitHandle.WaitOne();
// wait for the workflow to complete and then check the method expected were called
Isolate.Verify.WasCalledWithExactArguments(() => fakeItem.Update()); Isolate.Verify.WasCalledWithExactArguments(() => fakeItem["Approved"] = "True"); } }

If you try this without the fix TypeMock provided me with, the two verifies will fail, I am told this is due to a threading issue. Interesting that this is SharePoint specific as the same basic method works OK for standard WF workflows.

I also understand this fix will be in the next TypeMock release, I will update this post when I know for sure

Book Review 'Software Testing with Visual Studio Team System 2008'
Thu, Apr 2 2009 11:08

A book arrived recently on my desk 'Software Testing with Visual Studio Team System 2008' by Subashni. S and N Satheesh Kumar. On reading the book it provides a workmanlike coverage of the testing features of Visual Studio 2008 including some of the API options in the testing namespace, but I can't see what it adds to the subject beyond what is a user already has access to in the general introductions on MSDN/Help files.

My major problem with the book can be summed up from the blurb on the back 'testing is neither an easy process nor remotely exciting for developers', OK maybe true but I would argue this is just because they are not test infected yet. I am not going to go all puritanical here over Test Driven Development, but any developer who feels conformable about having code that is not as testable as possible is not professional in my eye. As soon as you look on testing as your safety net it starts to impact all your design decisions and your ways of working; it becomes not boring but a stimulating mental challenge as to how to make your system as testable and robust as possible.

This book covers the basic tools and menu options for Visual Studio 2008 testing, but it does not really help to explain why to use various tools; it does not provide a basis for the intent behind the various testing techniques. Knowing the tools exist is not enough. Knowing how to apply technique is the key here, I don't actually care how a technique is implemented in a given IDE or testing framework; I can look that in the vendors manual up when I need it e.g. as a programmer I need to know I could use row based unit testing techniques but I don't care about the actual format of the MbUnit, or MSTest API, that is for intellisense.

This problem is apparent in the books focus on the automatic unit test generation tools in VS2008, OK the wizard exists, but I would never recommend they are used, they tend to produce fragile tests of little business value. If you want to automatically generate test cases look at Pex, but that is too cutting edge for most projects(and beyond the scope of the book), so better to focus on good simple manually code unit test using a good design model, which this book does not cover - I suggest you check a book like Roy Osheroves 'Art of Unit Testing' for this type of material.

For me this book, like so many, is coming from the wrong end of the problem. The tools are important and some are better than others, but far better to drive the knowledge from the technique to the tool as opposed to the other way round. In my option the only case where a book on a tool that useful is when it provide tips and trick (like Sara Ford's Visual Studio Tips: 251 Ways to Improve Your Productivity), but this book does not really provide any good tips or trick either.

So if you are looking for a printed bound copy of basically similar contents of the MSDN on your desk then have a look at this book, but you could just read the introductions in MSDN online. However in my option neither place is the place to start of you want to learn how to write good quality tests, go back the basics and learn the theory and technique.


This Blog





Email Notifications


  • This site is a mirror of http://blogs.blackmarble.co.uk/blogs/rfennell