Automation cleanup in OneNote

One of the tasks the test team can look forward to completing over the next few weeks is "automation cleanup." Over the last three years of getting OneNote 2010 completed, we've overhauled our automation system, added a new "task library" of common code to get our testing completed and have written hundreds of new automation test scripts.

And as you can imagine, there is a sizable pile of "to do" work items that we can now address. For instance, one of the easier tasks (to explain and do) I'm currently completing is a hard coded string reference to the version of OneNote installed. In order to get a particular registry key, we might have allowed something like this:

string myRegKey =- @"HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\OneNote";

Notice the "14.0" in the string? Early in the cycle, we did not have a method to use which would tell us which version of Office was installed (we did not implement that at first). So if you need to read/write a registry key, you had to hard code the "14.0" string in the path. You would also leave a little "To Do" note to fix this once we implemented

public string GetOfficeVersion() {…}

So now I have a (very small) work item to essentially find and replace the "14.0" references with something like this:

string myRegKey =- @"HKEY_CURRENT_USER\Software\Microsoft\Office\" +

GetOfficeVersion() +

@"\OneNote";

Now the test will be more portable for future versions of OneNote, whatever version number they may be. There weren't very many instances for this across our automation system so this is truly a very small task.

The only other small consideration for this is whether or not GetOfficeVersion() logs an error if it cannot tell what version is installed. It does, so I don't need to worry too much about getting a blank string back. This is good because the test will log a failure at the earliest point of failure. If I tried to log the failure later in the test, it might take me longer to investigate what went wrong after the fact.

Questions, comments, concerns and criticisms always welcome,

John