Unit Testing in ArcGIS… making headway

Posted by Dave Bouwman | Posted in Uncategorized | Posted on 21-03-2005

0

This problem has been bothing us for quite a while – how to create and run unit tests for classes that run inside ArcGIS. I’ve searched the ESRI forums, and dug around the corners of the ‘net and have not found a pre-canned solution.

For those not famillar with unit testing, the basic idea is to write tests (code) which validate the logic of a piece of software. This is typically done at the function level – i.e. for an function like “Add(int Num1, int Num2) as int”, you would write tests which ensure that 2 + 2 = 4 and so on. (When done in practice, it’s important to test bad conditions to make sure the function fails gracefully.) For most stand-alone software, writing the tests is pretty simple, and there are a number of open source tools to help you with this (NUnit & JUnit come to mind). The problem with doing this for ArcGIS customizations is that the objects you are trying to test rely upon ArcMap (or ArcCatalog) to host them. Thus you can not just simply instantiate them in a test block. You need to actually execute the tests in the host application. The typical way of doing this is to start the app, and literally run through the functions, and see if they work. This is viable for smaller projects, but when you get to applications which have multiple assemblies, a dozens of tools, a myriad of utility classes, and some feature class extensions for good measure, it’s simply not a viable strategy. Automated testing is required. Since these are they scale of most of our projects at Sanborn, this has been a thorn in our side for a while.

Thus I’m pretty excited to say that I think we’ve cracked the nut. The basic idea is very simple – implement another interface on the objects you want to test, and use that as a hook into a very simple harness. John Cowardin is trying it out, and I think the design is going to work. Once we’re sure we’ve got it, we’re going to write up a “white paper”, and post it on our “soon to be operational” Sanborn GIS portal. I’ll post the link when it’s live.

Sanborn Solutions and Wireless @ Home

Posted by Dave Bouwman | Posted in General | Posted on 03-03-2005

0

The news is out – Sanborn Map Co. purchased the Space Imaging “Solutions” division (my employer up to March 1). As such, I’m now working for the very new “Sanborn Solutions” division. I’m very excited about this change. I’ll need to work out the details of blogging on topics related to work stuff, so for a while, I’ll be posting stuff that’s more general in nature – i.e. no code!

On a totally different topic, I just setup my new DLink AirPlus Extreme (DI-624), and I have to say it rocks. Simple setup, fast speed anywhere in the house, and a good price on Amazon. Now I can be a total slacker and watch TiVo and do R & D work…