Page 2 of 2
Previous

Agile Project Management for GIS

Unit Testing

Unit Testing simply means writing test code that executes your production code and validates its behavior. Some might ask why this is needed – doesn’t the developer test the code as it’s developed? In large systems, making a change to one area of the source code could have wide ranging impacts which are not obvious to the developer. Manual testing of a large system can take days or even weeks. Thus having a set of automated tests can help locate these regressions rapidly. To make the testing process easier, there are a number of testing frameworks that can be used. In the .NET world, the most widely known and used is NUnit, although there are many others including mbUnit, and MSTest. Without getting into the details, the testing framework provides some functionality to help with the testing - mainly ways to assert that the expected behavior did or did not occur. When writing tests, you should focus on testing small blocks of code rather than one big block. This helps enforce good object oriented design (low coupling between classes, cohesive design) as well as giving the developer a better handle on where the error actually occurred.

For developers working with the ESRI ArcGIS platform, there are many additional challenges - how to efficiently pass spatial data into a test, how to design code that can be tested, while at the same time correctly integrates into the ESRI platform. Over the next few months I will be covering these issues, including the use of mock and fake objects on my blog at http://blog.davebouwman.net.

Automated Build Process

One of the big hurdles that most waterfall projects face is the final integration - getting all the parts and pieces of a system to come together at the end of the project. By setting up an automated build process, the team is able to build the entire system at any time. The build box becomes the authority on whether or not some code "builds" - it's not enough for a developer to say "it built on my box!" Once you have the code building, you can then take the build process further and integrate the unit tests, and packaging into an installer. I've heard of some teams who go to the extent of then creating a set virtual machines (different target platforms), installing the fresh build of software on them, and running front-end tests in the VMs!

There are a wide range of tools to facilitate automating builds - MSBuild which comes with the .NET Framework, and NAnt are the two most common systems in .NET. Both use a declarative Xml syntax which takes some time to get used to, but they are free, and extremely powerful. There are also some GUI driven tools such as FinalBuilder which work with a wide array of compilers and source control systems. Due to the regular releases in an agile project, an automated build system is almost mandatory for an agile team - it's well worth the investment in time.

Continuous Integration

A continuous integration (CI) system basically ties the automated build to the source control system. When a developer checks in changes, the source control system alerts a service which then initiates a build. If any errors occur, the entire team is immediately notified - there is no waiting for the nightly build to find out whose code "broke the build". Once you start using a CI system, you will not want to work without one. Figure 3 shows how a CI system integrates with the development environment.



Test Driven Development (TDD)

TDD is a development methodology in which the tests are written before the production code. This has a number of benefits. Since the tests are written first, you ensure that the design is testable. Second, you have tests for the entire system. It also helps you to avoid adding in features you “think” you'll need. Here’s a good general rule: If you can't write a test for it, you should not build it. TDD is a very common extreme programming (XP) technique and has many vocal advocates. Implementing pure TDD for GIS projects can be very difficult because of the additional complexity of dealing with spatial data types. As more GIS developers start trying to work in this manner, these issues will be resolved through open source projects which will provide the scaffolding required.

Summary

Hopefully this article has provided the reader with a good introduction to the concepts of agile software development, and some of the tools that can be used to help streamline the implementation on GIS development projects. Please see the Other Resource section for links to sites with more information on the tools and practices mentioned in this article.

Other Resources

Source Control

Subversion: http://subversion.tigris.org/project_packages.html

Free Hosted Subversion spaces at Assembla.com

Subversion Clients

TortoiseSVN: http://tortoisesvn.tigris.org/

AnkhSVN: http://ankhsvn.tigris.org/

Code Documentation Tools

NDoc: http://ndoc.sourceforge.net/

Sandcastle: http://www.microsoft.com/downloads/details.aspx?FamilyId=E82EA71D-DA89-42EE-A715-696E3A4873B2

Build Tools

MSBuild Reference: http://msdn2.microsoft.com/en-us/library/0k6kkbsd.aspx

NAnt Download: http://nant.sourceforge.net/

FinalBuilder: http://www.finalbuilder.com/

Unit Testing

NUnit: http://www.nunit.org

mbUnit: http://www.mbunit.com

TestDriven.net: http://www.testdriven.net/

MSTest Reference: http://msdn2.microsoft.com/en-us/library/ms182489(VS.80).aspx

Refactoring Tools

Visual Studio: http://msdn2.microsoft.com/en-us/library/ms379618(VS.80).aspx

ReSharper: http://www.jetbrains.com/resharper/

RefactorPro: http://www.devexpress.com/Products/NET/IDETools/Refactor/

Continuous Integration software

CruiseControl.net from Thoughtworks

http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET

About the Authors:

Dave Bouwman:

Over the last 10+ years Mr. Bouwman has been designing and building enterprise geospatial application on the ESRI ArcInfo & ArcGIS platforms. More recently he has taken a keen interest in improving the software process and has been working on tools and techniques enabling GIS developers to increase software quality, maintainability and predictability. You can follow along or contact him through his blog (http://blog.davebouwman.net) or connect at LinkedIn (http://www.linkedin.com/in/davebouwman). He is currently working for Data Transfer Solutions as the Senior GIS Software Architect.

Chris Spagnuolo:

Mr. Spagnuolo has also been working in the geospatial industry for 10 years, and has been a leading figure in raising awareness of Agile practices within this community. As the Agile Evangelist at Data Transfer Solutions, he is leading the company wide transition to Scrum. You can read more about agile and scrum at his blog (ww.chrisspagnuolo.com), or connect at LinkedIn (http://www.linkedin.com/in/chrisspagnuolo)

Page 2 of 2
Previous