I love test tools – they make testing OneNote much easier

    Earlier this week I opened up my list of bugs assigned to me and noticed I had one that was asking for more information. The details are long, arcance and, frankly boring, but the gist of the bug was some timing related problems if a user was both creating and opening folders from the hard drive as notebooks very quickly. "Quickly" in this context means creating and opening 5-10 folders per second - much faster than I could do this manually, but not that unreasonable for an automated tool to complete this test.

    To see what I was doing, notice what happens if you right click on a folder on your hard drive:


    If you have .ONE files (sections) within that folder, OneNote will open it as a notebook and show the sections. In turn, if that folder has subfolders with OneNote sections in them, they will open as section groups. This is different than document based applications like Excel in which you typically work with a file. OneNote is more of a directory based application.

    Back to the task at hand. To recreate the conditions reported in this bug, I had to be able to create 5 or more folder per second, right click on each and select to "Open as Notebook in OneNote." This is not something I can do by hand.

    Instead, I used a tool to create folders on the hard drive quickly. Using C# and the .net framework, I was able to create about more than 20 per second. The code for this is pretty simple and there is sample code at http://msdn.microsoft.com/en-us/library/as2f1fez.aspx. Using the OneNote extensibility API, I can simply call the OpenHierarchy method and pass it the folder path the tool just created as the first parameter:


    Since I'm opening the folder as a notebook, I don't need to worry about the second parameter. Since I did not actually need .ONE files for this, the optional parameter at the end to create one can be ignored as well.

    Now I'm set. I ran the tool, verified the initial problem had been fixed, and attached the tool to the bug report (and the code is in our test repository as well). Now, if there is ever a regression related to this, the next person has a tool ready to help immediately.

    Little tools like this make testing so much easier.

    Questions, comments, concerns and criticisms always welcome,


Comments (2)

  1. jzk says:

    It’s a great tip, thank you for sharing !

  2. Pompe biere says:

    Yes, really great tip, thank you.

Skip to main content