Rob Smyth

Monday 20 September 2010

Using Log2Console from NLog via MSMQ

I've been using Log2Console to view real-time logging for a while using the Chainsaw target and UDP. But UDP is not reliable for fast real time logging. I found a simple way to configure NLog to send messages via MSMQ in the Log4JXml format used by Log2Console. It recon this could be used with any NLog target.

Here is the NLog config:

<target name="messageQueue" xsi:type="MSMQ" queue=".\private$\log">
<layout xsi:type="Log4JXmlEventLayout"/>

So simple.


Thursday 19 August 2010

Cube Farm Designs That Cut Out Conversation

The 2006 Waterfall Conference proves to provide timeless value. Those who know of Alistair will appreciate his input on office layout here.

Code Smell Metric - Doco Fluff Metric (DFM)

Code documentation is one of those things that is so easy to do to without adding anything useful. The problem is that the added lines of code/text appear have no value and reduce code readability. A case of less is more. Documentation can be useful, but nonsense documentation is worse than no documentation at all.

So a metric that detects nonsense documentation ("fluff"?) is another little helper.

Here is a real world example:

/// <summary>
/// Thread Name.
/// </summary>
public string ThreadName;
/// <summary>
/// Time Stamp.
/// </summary>
public DateTime TimeStamp;

A trival example but I recon it is less readable than:

public string ThreadName;
public DateTime TimeStamp;

So the metric is: If the documentation, with white spaces removed, case insensitive matches the property, method, or type then flag as doco fluff.

Tuesday 27 July 2010

Agile Software Testing 101: Stress Testing

So your a software tester and you have received a new build with a new feature to test. How do you stress test it? Not difficult, you just need to know the pattern of "Stress Testing" to find those weak points. Here is a simple agile "how to".

Agile principles can be applied to testing. When done they leverage the tester's skills with the developer's skills.

  1. Being agile (as we all are) you let the developer responsible know that you are about to test the new feature.
  2. As agile means collocated, you make sure you are near the developer and he/she can see your screen. Think of this as limited-pair testing perhaps, an agile balance of full pairing and letting the developer get on with his job.
  3. To enhance your pairing make sure you have a mirror so you can see the developer. Collaboration is critical to stress testing.
  4. Now go to the UI page that uses the feature and sweep your mouse pointer over the page watching the developers. When you see signs of stress ... click.
Stress testing saves time and leverages agile principles of, well, whatever your company says is agile today.

Wednesday 21 July 2010

Oath of Non-Allegiance

Alistair Cockburn again challenges us. Check out the "Oath of Non-Allegiance" here.

I'm sick of hearing 'they are not agile because they use UML' or 'In agile we stand up and spin clockwise every 42 minutes".

Now I will go back to making my agile coffee on my agile PC and writing lots and lots of agile modelling diagrams. I wonder if my agile undies have arrived?

The term 'Agile' has joined the livings dead, its meaning and purpose of the manefesto is long gone. It is now used to mean whatever you want like Scrum, eXtreme Programming, or just anything.

May tolerance, an understanding that all processes are broken, and the bravery to find 'what works', replace it.

Monday 12 July 2010

Using Visual Studio 2010 over RDP With Dual Screens

I often work from home and want to use my work box with dual screens but my home monitors have different resolutions. Normally, with a VPN/RDP connection, the windows RDP software cannot handle dual screens nicely and not at all when they have different resolutions. I like SplitView, it allows me to do this.

At home I have laptop and an external monitor. The laptop has a 1680 pixels across and the monitor has 1920 across. Needless to say I want to use both with Visual Studio's main editor on the larger monitor and the debug, output, unit tests windows on the smaller laptop monitor. With SplitView I can connect to my work computer and use both. The nice thing is that I can maximise an application within a monitor without it filling both monitors.

It is a little tricky (you do need to read the doco) to setup as it does layer over RDP. With a little fiddling about with the screen sizes it works nicely.

But the screens are not exactly the same and when I return to the office after working from home I find that the screen layouts have changed. A bit annoying. Move the VS2010 properties window here, output window here, etc. So I saves my "in office" and "rdp" layouts using VS's "Import and Export Settings". First get the layout you want and the export it by selecting "General Settings | Windows Layout" only. Then from home, or in the morning, you can quickly restore world order to your windows. Nice.

Friday 9 July 2010

Continuous Integration can build time dependency

It seems to me that there is a dependency between Continuous Integration (CI) and build time. Each time I hit a slow build it puts pressure on 'fast' CI. It seems that if the build is slow then CI may be more destructive that beneficial. I'm thinking it is all a question of ratio.

CI does not define an integration rate. Some teams see CI as once a week, others see it as every 15 minutes. It is a relative concept.

If a build box can build and run all tests in, say, 1 second then a team's commit rate of once every 5 minutes would seem achievable. Each developer would have instant feedback and be able to fix, or revert, any problem within a couple of minutes, after a commit, with minimal effect (without considering a pre-commit test system). But if the build takes, say, 30 minutes and the team's commit rate was once every 15 minutes then by the time a build failure is detected the whole team is affected.

So it seems to me that there is a relationship between CI's rate and build time. Just do not know hat it is yet.

Visual Studio 2010 build speed - kinda Windows 7 really

When I moved to a new project using Visual Studio 2010 the build time seemed very very slow. But it would seem the problem is more to do with Windows 7. We are using Subversion, VisualSVN, TortoiseSVN for RCS. I have been perplexed as to why we no longer get icons in Explorer and today I found the solution here.

Once I ran the spell:
netsh interface tcp set global autotuninglevel=disabled.
The world order was restored. VS2010 compiled 2 times faster, Explorer icons came out from hiding, and Explorer was happy (much much faster).

Monday 14 June 2010

Build Management

Over the last few years I've worked on .Net projects using a few build management sytems. My ratings, best first:

  1. TeamCity
  2. Cruise
  3. CruiseControl
  4. TFS

TFS 2010 is a still birth

The last few months I've been on a new project using Visual Studio 2010. Being a green field project we started out going for the very latest suite of Microsoft integrated tools using TFS for project management and revision control. What we found was that TFS was ... hmmm ... how do put this? ... still born. Try as we did we just could not give it life and after months of painful efforts we ditched it for subversion and TeamCity so we could get on with the project.

I just could not find anything about TFS that was, in a professional sense usable.

My summary of TFS:
  • RCS - it loses code changes. It is also difficult to use, and has a merge-phobia, but the corruption thingy is kinda a slam dunk. Subversion is way ahead and hey ... it keeps your code changes.
  • Project Management - Notepad is better.
  • Build system - works but is difficult to manage. TeamCity is much better.
  • Integration - Best described as 'share the pain'. Other, non-Microsoft, tools integrate as good. e.g. VisualSVN.

Details below. If your going to read further either you find it hard to believe Microsoft could do such a thing (yea, me too), your a Microsoft basher looking for a fix (go away!), or you need know the experience to avoid it.

RCS Ability


My experience with TFS for revision controls was .... well ... it doesn't work. It is that basic. Well actually it is worse, it silently drops changes. Yep, a revision control system (RCS) that actually looses code. Hard to believe, and we were so sure that nobody could release such a bad RCS that we thought that it had to be the way we were using it. But no, check in your changes, then update and guess what? Your changes are gone!


That TFS cannot reliable keep code changes is sufficient to just forget it and move on. But I suppose that may be fixed. Trouble is that this dude is just way out of its league. TFS's idea of a merge conflict is that the file changed . Its merging is so bad that continuous integration (CI) collaboration is expensive. It sometimes even reports files that it cannot merge files that, it says, are the same.

TFS is merge-o-phobic.

Working with a build system:

One real attractive feature with TFS is that it offers the ability to compile and run all tests on a build system before accepting the commit. Nice ... but ....

It works, most of the time. Trouble is that TFS's merge-o-phobia kinda negates this feature but ignoring that TFS sometimes reverts all of your code when you do one of the commits. Not always mind you, and it does not tell you if it did. Surprise! If it does, and you realise it, well you just have to go make a coffee while the build system decides if your code can go it. That down time is optimistic :-).

For Project Management

TFS is just fine if your project's always go exactly as planned in a gantt chart. So why do you need a project management tool?

I'm serious when I say that notepad would be a better tool. Excel would be far better, and VersionOne just awesome.

For what is called 'agile' style project:
  1. Burn down reporting does not work.
  2. Move a story to a different iteration and the tasks stay behind. Hey try to do iteration planning with that!
  3. Story prerequisites are meaningless. You can put a dependent story in an iteration preceding it prerequisites.


In the end we gave up and now use: Subversion with TortoiseSVN and VisualSVN, and TeamCity. We can deliver working functionality more often now as we can spend more time coding features and less time working with infrastructure.

But if subversion ain't for you as you need something real expensive with lots processes to be sure to be sure that you really are going to commit that code then I can say that TFS is even worse than ClearCase. ClearCase does not loose code changes. It may slow them going in but it does not loose them. And ... trump this ... ClearCase is so much more expensive.

Sunday 13 June 2010

My favorite robot remains Robbie from forbidden planet but this Lipson guy is awesome with his assembliage robot (another guy's work pictured above).

Now these are sculptures I wuv:

The "Rapid 2" Assemblage Robot Sculpture is my favorite. My birthday is coming!


Saturday 3 April 2010

Fault Tolerant Automated Functional Tests Oxymoron

Microsoft seems to be pushing making coded UI functional tests fault tolerant by using multiple methods of 'finding' controls on a page. If it can't find a control as its text has changed then it tries another approach. I recon it more likely to cause more problems that it would solve. At best it is unnecessary, and worst it will allow tests to pass when they should fail. Like over use of null reference guards in code that hide defects.

Microsoft's automation tools generate code that uses multiple approaches (fault tolerant) to find controls. I'm also seeing examples of this approach in VS2010 documentation/tutorials.

e.g: 4 minutes into: Introduction to Creating Coded UI Tests with Visual Studio 2010.

I do not understand the need nor the intent. On the 'need' level it implies that there is not a reliable method for finding a control although each control has a name or AutomationId that is independent of location, inner text, colour, visibility. On the intent level, if the control changes so you can not find it ... well ... I would rather the test failed.

I use test jigs and testers (thanks Nigel ... a pattern that should be documented) to access UI controls. Typically a page has a test jig and a property on the test jig provides access to control's tester or test jig. So, I have one place in which I define the control's id (e.g. AutomationId). So if it changes I just change one line.

Fault tolterant test code is an oxymoron.

Perhaps the next step is to make tests intermittent failure tolerant by retry on fail. :-)