Monday, 23 April 2012

Automated testing: you know you need it, but how do you do it?

The world is becoming more and more Agile and many companies are discovering the undeniable truth that Agile software development provides a cost effective solution for delivering working software. Adopting Agile processes within your company and changing the general ethos of your working environment can be harder than it might first appear. Sure, the introduction of daily stand ups, user stories, story points, planning sessions and retrospectives all help to improve the efficiency and communication within your company but there is one important part to the process that gets left out because it is deemed "too hard" to start doing immediately - and that is Automation.

Automation is a fundamental piece to the Agile development puzzle that often gets overlooked and it is only when a development team is struggling to cover all of it's regression tests and bugs are starting to be found by customers that companies generally look to do anything about it. Without automation, every piece of software that gets written, tested and shipped to the customer becomes another piece of technical debt that must be manually tested in order to ensure that any future work does not impact the original expected behaviour of that software. Most software development teams try to negate this by hand picking "just enough" regression tests to cover what they believe should have been impacted by any changes within the current release and generally this works well enough until something "just gets missed".

Numerous studies have been made into the cost effectiveness of finding a bug as early as possible and it should be no different for finding regression bugs, but without increasing your test team exponentially as your technical debt grows it is inevitable that you will have to face the fact that you will need to automate your software testing, the question then becomes how?

Getting started with test automation?

I believe a good place to start is to look at what your current testing practices look like in the Automation triangle. There have been a number of authors (including but not limited to Cohn, Mezaro and Crispin) that have written about the concept of an automation triangle and this something that I wholly believe in. The image below shows some of the subtle variations of the automation triangle amongst authors and I recommend that you do some further reading around.

image

The base of the triangle represents your unit testing level and this should contain the vast majority of your tests. The second level are tests that check the service or api layer, this is where I believe you can obtain the most "bang for your buck" in testing and yet it seems to be the area where most test teams are lacking. The third level of the automation triangle is UI automation tests and finally at the fourth level there is still some need for exploratory manual testing but the critical point here is that if an issue is found whilst manually testing the system then this should be captured as an automation test as soon as possible in order to minimise the technical debt.

In my experience, most software development teams already do a lot of unit testing which is ideal for working in small units and testing elements in isolation but when it comes to automation of acceptance tests they are somewhat lacking. When the discussion of automation of acceptance tests begins it almost certainly starts by looking at automating the user interface (UI)  of the product, after all this is what the customer sees, right? Unfortunately there is an implied cost to implementing UI automation tests that means they are generally the most brittle, the most costly to write and they take the longest time to run. That is not to say that there is no place for automation of the UI, quite the contrary in fact there is immense value in performing UI tests but these must be carefully chosen to ensure you are getting the most value in the least brittle way and the least time possible.

As companies start to implement automation tests the trend to gravitate towards implementing UI automation tests ends up making the automation triangle look a bit more like an hour glass shaped automation rhomboid with few if any service/api level tests. I believe the reason for this is that UI testing does not generally require a technical understanding of how the application works underneath. Tests can be written (using a huge variety of different types of tool) from the view of a system user and as such only tests things that the user can see through the UI of the system. This generally results in all test setup, execution and assertions to be performed via the UI which all takes time (too much time in most cases).

Typically the UI tests will be created using a point and click style of UI testing tool that allows the test team to learn and embrace a tool that they can own and take control of that will free themselves from some of the manual day to day grind of regression testing without the need for the developer team's involvement. Unfortunately choosing UI automation test tool is not enough to ensure the successful implementation of an automation test strategy.

How can I implement a successful automation strategy?

In my opinion, communication and collaboration is one of the most important aspects of Agile software development. Any tools that a development team chooses should first and foremost help to radiate knowledge and increase the overall ability of the team to interact and adapt to their ever changing environment in the quickest way possible. What I mean by this is that the process of determining what automation is necessary should be an integral part of the development teams process from the very start of the project and each subsequent iteration instead of something that the test team goes off and just gets done.

Summary

I thoroughly believe that in order to get the most bang for your buck from your test automation strategy you need to implement of a process that helps improve the communication and collaboration within your team so that testers are working closely with developers at all levels of the automation triangle, the goal of this process is to make your developers better testers and your testers better developers. After all each member of an Agile team should be cross functional – it may well be that your testers are your worst developers and your developers are your worst testers but the key thing to strive for is that they work together in order to deliver a better quality product.

Next Steps

Why not have a think about different ways that you could try and improve the way in which your development team members (Product Owner, Developers and Testers) collaborate and in my next post I’ll look at what I believe is the key to implementing a successful automation test strategy.

Friday, 20 April 2012

Getting the current framework SDK path from within MS Build

In LeaveWizard we currently use Linq To Sql and to generate a data context we use SqlMetal as part of the pre-build process of our data access assembly, the xml looks something like this:

 <Target Name="BeforeBuild">
<Exec Command="&quot;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SqlMetal.exe&quot; /server:.\HEATHERSQL01 /Database:LeaveWizard_UnitTests /code:LeaveWizardDataContext.cs /context:LeaveWizardDataContext /namespace:FeatureBase.LeaveWizard.DataAccess /views /sprocs /functions /pluralize /timeout:1200" WorkingDirectory="$(ProjectDir)" />
</Target>



As you can see the path to the SDK version number was being hard coded, which has been fine for a long time until I configured a brand new build server which did not have v6.0a of the SDK installed it had v7.1, so I needed a solution.



Thankfully it seems easy enough to do this, simply get the current framework SDK path location like so:



  <Target Name="BeforeBuild">
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="WindowsSdkPath" />
</GetFrameworkSdkPath>
<Exec Command="&quot;$(WindowsSdkPath)bin\SqlMetal.exe&quot; /server:.\HEATHERSQL01 /Database:LeaveWizard_UnitTests /code:LeaveWizardDataContext.cs /context:LeaveWizardDataContext /namespace:FeatureBase.LeaveWizard.DataAccess /views /sprocs /functions /pluralize /timeout:1200" WorkingDirectory="$(ProjectDir)" />
</Target>


Job done!


“sgen.exe” error while setting up Team City Build Server

I’ve recently set up a local build server for LeaveWizard and came across an issue:

“C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2249, 9): error MSB3086: Task could not find "sgen.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed”

After a bit of Google searching the answer was pretty simple, just download the latest version of the Windows SDK and then install the .NET Development Tools, simples Smile.

Update:

I came across the same issue whilst installing another build server, this time it was on a Windows 2008 Server. I installed the SDK as stated previously but I was still getting the problem. It seems that the registry key for v7.0A just did not exist. Further Googling identified that you can configure which SDK version should be used by performing the following steps:

Go to “Start | All Programs | Microsoft Windows SDK 7.1” and start the “Windows SDK 7.1 Command Prompt”.

Type:

cd Setup
WindowsSdkVer.exe –version:v7.1

Now re-run your build and hopefully the problem has gone away, if not good luck finding the issue.

Life, Times and LeaveWizard

Well it has been far too long since I last ventured into the world of blogging but it seems that life suddenly got a little busy for me. What with having my family growing with the addition of two fantastic boys Jacob and Lucas and the very latest arrival (just over 1 week old) is my new beautiful baby girl Isabelle, co-coordinating of NxtGenUG Southampton, software contracting with Fitness First and more recently Active Navigation, working on a fantastic online leave management product with my good friend Plamen Balkanski time just seems to slip away from me.

Plamen wrote a post a little while ago about our product LeaveWizard for the first time since we’ve been developing it and this prompted me to think about my own blog (albeit a couple of months later) and how I could resurrect it by starting to talk about the kind of things we are doing with LeaveWizard. Previously most of my posts have had a bit of technical bias and I am sure that there will be plenty more of that to come but to kick the blog off again I thought I would just talk about what we’ve been doing with LeaveWizard.

So what is LeaveWizard anyway?

LeaveWizard is something that both Plamen and I are completely passionate about, we both seemed to have generally bad experiences when it came to holiday bookings. It always seemed like a hassle going something a little like this:

  1. Go the HR team to pick up a holiday card
  2. Determine what holiday allowance you actually have remaining (after a few discussions with the HR team about what leave you didn’t end up taking in the end)
  3. Fill in all the relevant details and dates
  4. Put the holiday card on your managers desk for approval (it generally goes straight into their in-tray because they are very busy and they are never at their desk)
  5. Wait a couple of hours/days/weeks and ask your manager whether the holiday has been approved or not
  6. Your manager finally approves the holiday and passes it on to the secondary approver (once again going into an in-tray because they are not at their desk)
  7. Wait a couple more hours/days/weeks and ask the secondary approver if it has been approved or not
  8. The secondary approver finally approves the holiday and gets the card back to HR without actually telling you whether it was approved or not
  9. You then have to chase HR or the secondary approver to ask whether the holiday has been approved and you eventually get the confirmation you needed (this is normally the day before you are actually leaving for your holiday)
  10. At this point all is well from your point of view but more times than not it turns out that during the time it took to get your holiday approved, a couple of other people on the team also had their leave approved and they end up being on leave at the same time as you!!!
  11. This eventually causes a nightmare because you and this other guy should never be off at the same time and you end up getting in the neck because you didn’t collaborate over when you should or should not be on holiday!!

If this kind of thing sounds in anyway familiar then you will totally understand why we created LeaveWizard, we just figured it shouldn’t be that hard. So we set about creating a tool that would make the process something a bit more like this:

  1. Log on to an online system that is available any time and anywhere across the globe
  2. Instantly have access to your current leave allowance
  3. Click a request leave button and enter your leave dates and submit your request (if too many people in your department are off on those dates already you are instantly notified)
  4. Your leave request is instantly sent to your manager via email who can quickly see who else is on leave at the same time and instantly approve the leave request
  5. You are sent an email stating “<ManagersName> has approved your leave and it has now been sent to <SecondaryApproversName> for secondary approver” so you know exactly what stage your leave request is at
  6. The secondary approver receives an email detailing the leave request and can also see who is on leave at the same time and simply clicks “Approve” directly from the email content
  7. You are then sent a confirmation email stating that your leave has been approved…woo hoo time to go on holiday!

Now I don’t know about you but I know which process I prefer which is why we created a tool to allow us to do exactly that and a whole lot more from request and approving overtime, defining flexible work patterns, configuring time off in lieu LeaveWizard has become an extremely flexible holiday management tool.

If you think that you company could benefit from using a tool like LeaveWizard to management your staff holiday, absences and vacations then why not try it out, it is totally free to use for up to 5 users. I would also love to get your feedback on anything you would care to comment on.

Monday, 7 November 2011

Deploying a VSTO Click Once Add-in - don't forget your MIME Types!

I just wanted to make a note of this for future reference and to help any one that might be struggling with this in the future:

I have just created a simple Excel 2007 office add-in and I wanted to deploy it to a local server on my intranet and allow other users to click a url and install the application. Using the project properties page I configured the relevant server details and successfully published the add-on on to the server.

image

But when I navigated to the specified install url I received 403 error This website requires you to login. After searching the web for a suitable answer I finally stumbled upon the answer on this web site:

http://social.msdn.microsoft.com/Forums/en-MY/winformssetup/thread/10ee1ca1-b3ae-4a6f-98ba-125179b9e417

In summary, don't forget to configure the .'vsto' MIME type with 'application/x-ms-vsto' on the virtual directory containing the add-in.

Wednesday, 5 October 2011

CodeKen - the replacement conference for StackOverflow DevDays

CodeKen London 2011 is a brand new developer conference delivering two days of hands-on coding oriented content over the 14 - 15th November in London. The event was organised in response to the cancellation of the Stackoverflow DevDays conferences and includes many of the original speakers like Jon Skeet, Robert Pickering and Richard Marr.

The talks cover a wide range of subjects including programming style, MongoDB, NodeJS, HTML5, REST services and more.

In addition to an eclectic mix of talks CodeKen 2011 is launching a developer side project competition. The goal is to encourage and publicise developers that are spending their spare time working on interesting projects. Five finalists will be given a free ticket to the conference and a chance to present their project at the event.

See the full conference schedule and more information on the CodeKen Side Project competition on the conference site - http://london2011.codeken.com

Monday, 5 July 2010

NxtGenUG Fest 10 - “Beside the C# side” – Bournemouth 16th July

NxtGenUG are pleased to announce their annual conference Fest10 will be taking place on Bournemouth Pier this year on Friday the  16th July 2010 – It’s a great opportunity to take the family to the Seaside  for the weekend, and catch up on technology. The best thing is attendance to the conference is free to members and just £59.95 for non-members.

Speakers

We have a great speaker line up this year, Google’s Jon Skeet will be talking about C#, Microsoft’s Glenn Block is coming over from Redmond to talk about MEF, Ryan Simpson will be giving us the lowdown on F#. We’ll also be having NxtGenUG veterans Mike Taulty, on OData and Chris Hay on Azure, Plus Marcus Perryman will be talking about one of the hottest technologies this year Windows Phone 7.

You can find a list of speakers and their sessions here

http://www.nxtgenug.net/fest10/Sessions.aspx

To register simply go to the following link and follow the instructions on screen.

http://www.nxtgenug.net/fest10

Parking, Hotels and Timings

Upto date Details on parking, hotel accommodation and timings for the day can be found on the Fest10 site. The nearest parking for Bournemouth Pier is either in the Bournemouth International Centre (BIC - 20) car park, the Bournemouth Pavilion car parks (19/24) or the car park next to the Royal Bath hotel (18). However, there is also further car parking available at Eden Glen car park (21), Winter Gardens car park (22) and Beacon Road car park (25). For Hotels, the RusselCourt is where the evening entertainment will be Quote: NxtGenUG when booking, otherwise Bournemouth has a large amount of hotels, including the Best Western Hotel Royale.

http://www.nxtgenug.net/fest10/

Geek Dinner

It's the Fest10 geek dinner - normal rules apply - pay for your own food/drink, and engage in great conversation, and eat fish and chips at Harry Ramsden’s. To register for the geek dinner

http://www.nxtgenug.net/ViewEvent.aspx?EventID=322

Post Fest Party

We’ll also be having a post Fest Party at the RusselCourt Hotel – If you’ve brought your family down for the weekend feel free to bring them along. Just register on the site and drop us an email on how many people you’ll be bringing with you toenquiries@nxtgenug.net

http://www.nxtgenug.net/ViewEvent.aspx?EventID=325

Sponsorship

NxtGenUG would like to thank DevExpress, our gold sponsor, along with Microsoft, RedGate, PluralSight and Apress for their support in making this event possible.