-
Watch...and wait. (Better with sound)
-
Very nicely done photoshop jobs
Nov. 29th, 2008
I Win at Geekiness!
Nov. 29th, 2008 09:39 pmI just solved a problem that's been killing me for two days at work.
I've been putting together automated Acceptance Tests at work, using Fitnesse to allow our business analysts to specify tests that are then run against the code on a daily basis before it's released to the system testers.
The problem being that they had some tests that didn't work - they wanted to check that only certain input was accepted in specified textboxes, that maximum lengths were set, etc. However, Textbox.MaxLength only affects keyboard input, it doesn't affect the .Text property if it's set directly.
So I spent Thursday and Friday trying to find a way of simulating keyboard input. Turns out that doing this is really, really easy if you can guarantee that the form you're testing is the top one on the desktop - i.e. the place where keyboard input would normally go. Problem being that I could guarantee that.
Ok - next step, grab a handle to the control I want to talk to and send it messages using PostMessage. Which I played with and got working in test code, and then couldn't get working in my actual tests. I realised at 5:30 last night that it wasn't going to work because I wasn't actually running a Message Loop - all of the forms are being launched via the TestRunner exe - and they don't work the same way they would if they had a windows message pump running in the background (if this makes no sense to you then this might help - or this for a longer explanation).
And then it hit me this afternoon - every control has a WndProc method in it (so that you can override it for custom message processing) - and I could call that directly rather than relying on the Message Loop to pass it to the correct place.
Fortunately I have Visual Studio at home, so I fired it up, played around for half an hour, and with a bit of reflection (because WndProc is "protected" rather than "public") I was happily passing messages to it.
I hate having unsolved problems - and I'm remarkably happy that I got this one done!
( Code here )
I've been putting together automated Acceptance Tests at work, using Fitnesse to allow our business analysts to specify tests that are then run against the code on a daily basis before it's released to the system testers.
The problem being that they had some tests that didn't work - they wanted to check that only certain input was accepted in specified textboxes, that maximum lengths were set, etc. However, Textbox.MaxLength only affects keyboard input, it doesn't affect the .Text property if it's set directly.
So I spent Thursday and Friday trying to find a way of simulating keyboard input. Turns out that doing this is really, really easy if you can guarantee that the form you're testing is the top one on the desktop - i.e. the place where keyboard input would normally go. Problem being that I could guarantee that.
Ok - next step, grab a handle to the control I want to talk to and send it messages using PostMessage. Which I played with and got working in test code, and then couldn't get working in my actual tests. I realised at 5:30 last night that it wasn't going to work because I wasn't actually running a Message Loop - all of the forms are being launched via the TestRunner exe - and they don't work the same way they would if they had a windows message pump running in the background (if this makes no sense to you then this might help - or this for a longer explanation).
And then it hit me this afternoon - every control has a WndProc method in it (so that you can override it for custom message processing) - and I could call that directly rather than relying on the Message Loop to pass it to the correct place.
Fortunately I have Visual Studio at home, so I fired it up, played around for half an hour, and with a bit of reflection (because WndProc is "protected" rather than "public") I was happily passing messages to it.
I hate having unsolved problems - and I'm remarkably happy that I got this one done!
( Code here )
Less geekily
Nov. 29th, 2008 09:50 pmIt was a very good party last night to warm the flat of
magenta_wings and
widowinparadise - I ended up staying until 2am, which is nigh unheard of in recent times.
It was a Mills and Boon (very trashy romance novels) themed party, and about half of us dressed up.
0olong read bits of one book out to great hilarity, and then various other people joined in later (I missed who was doing that, because I was in deep conversation by that point). In any case it was very good fun seeing people.
If you're friends with us on FB then you'll have seen them already, but here are three of my favourites including me and/or Julie:



Julie and
erindubitably didn't even plan their outfits in advance, it was just a lovely coincidence to have both the Black Queen and the Red Queen there...
![[livejournal.com profile]](https://www.dreamwidth.org/img/external/lj-userinfo.gif)
![[livejournal.com profile]](https://www.dreamwidth.org/img/external/lj-userinfo.gif)
It was a Mills and Boon (very trashy romance novels) themed party, and about half of us dressed up.
![[livejournal.com profile]](https://www.dreamwidth.org/img/external/lj-userinfo.gif)
If you're friends with us on FB then you'll have seen them already, but here are three of my favourites including me and/or Julie:
Julie and
![[livejournal.com profile]](https://www.dreamwidth.org/img/external/lj-userinfo.gif)