As I’ve mentioned before, we have been in the process of moving all of our automated tests away from being UI based and converting them to white box tests. The results have been very positive thus far, but it has not been a free conversion – there is a small cost to pay.
One of the tasks we completed last week was disabling the last of the UI based tests we had lingering around. They had always been "flaky" – failing with focus problems, timing out waiting for dialogs to be found, etc… The time was right to say goodbye to them and now we get to re-write the last of the scripts.
We have been converting them for over a year now. We started with the highest priority scripts first and got that work finished many months ago. Moving on to the medium priority work was next, and that work finished a little at a time and mostly wound up two weeks ago. We only had a handful of scripts left which used the UI (mostly menus and shortcut keys). Of course, there is a reason these were left for last. They are also the hardest convert. It’s a well understood but somewhat tedious process to work through the older scripts, and it is pretty obvious why they were left for last.
The way we are dealing with these scripts is by entering tracking bugs into our database and assigning them to individual testers to fix. So far, I’ve been calling them "TWIONT" bugs, with TWIONT being an acronym for "This Week In OneNote Test." I don’t like that acronym either. If you can think of a better one, please let me know. TWIONT does not roll off the tongue. Anyway, there are only a handful of these left, and I’m looking forward to being done. I don’t want to step through the code anymore to figure out what happens when you type two sentences and then press ALT+SHIFT+UP before checking against an oracle. On the flip side, by stepping through the code, I get to learn many nifty shortcut keys in OneNote.
For instance, in the example I just gave, the keystrokes move a line upwards. Try it yourself. Type this:
Now, with the cursor still blinking at the end of line 2, press and SHIFT, ALT and the UP key. You should get:
The code usually looks something like this:
SendKeys("This is the first line of a sentence.");
Sendkeys("Now I will type another line.");
//now perform a verification
//now perform a test of some sort
This creates a table, by the way. Sometimes it is fairly easy to just read the code and sometimes you have to perform the steps manually. And I always have to look up what the special keys like ~, + and % are for.
Oh, I have a very loosely related tangent to all this. There is an image in the OneNote 2007 Guide, buried in the More Cool Features section on the Audio and Video Recording page:
I have to believe this is no coincidence. I was thinking how difficult it would be to convert "just one more script" on Friday before I left when I opened this page and saw that text. After working through these last week, I now have a pretty good idea of the very practical definition of "marginal cost" as it applies to converting our scripts.
I’m "venting" to some extent here. It’s actually beneficial to me to step through the UI to learn some new aspect of the product to which I have not been exposed. The payoff is tremendous – much more stable automation which we can more easily use to as a metric to evaluate OneNote, I learn more about OneNote and can send Jeff information for the OneNote Tips blog and our scripts are vastly easier to maintain. The payoff has already happened for our most critical automation suite and now it is only a question of time to get these last loose ends tied up.
Questions, comments, concerns and criticisms always welcome,