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() +


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,


Comments (6)

  1. Hema says:

    Awwwww! That is so cute a task! 🙂 I mean, amidst all the complex things we do, such small cleanup TODOs are so nice! 😀

  2. John says:

    first time I’ve ever heard automation called "cute" 🙂

  3. Tricia says:

    Why does OneNote leave little files in the directories it browses?   And is there a setting to stop this?

  4. JohnGuin says:

    What are the files it is leaving behind?

  5. Tricia says:


  6. JohnGuin says:

    Sorry for the back and forth – but how many of these files do you see?  And what do you mean by "directories it browses"?  Are they only folders that have OneNote content, or do they appear in other locations?

    Feel free to email me via the link at the upper right if you need to.

Skip to main content