.netwinformstestingfuzz-testing

Any good tools or tips for fuzz testing Windows forms applications?


I'm maintaining a ~300K LOC C# legacy thick-client application with a Windows.Forms interface. The app is full of little bugs and quirks. For example, I recently discovered a bug where if a users edits and tabs (not clicks) through cells on a DataViewGrid, and leaves the a certain cell selected, the app gets an "Object reference not set to an instance of an object" exception. I discover (or get a bug report of) something new like this about every week or two. I've had enough, and was thinking of trying some sort of fuzz testing on the application to try to ferret out undiscovered issues.

If I roll-my-own fuzz testing, I'd assume I at least need to be able to generate test harnesses that run pieces of my app (main window, FormX, FormY, FormZ, ...) independently and try to inject events into them.

I was trying to look for tools suited for this, but so far have come up with nothing for Win Forms. (There seems to be no shortage of fuzz testing tools for web apps, however).

Any helpful ideas?


Solution

  • I always like the idea of the Gremlins test tool, used on Palm handhelds. It generated random tap events to flush out UI programming bugs. You could do the same in your app, generating millions of mouse down and up events at random locations. You'll need to P/Invoke PostMessage() and use Control.GetChildAtPoint() to generate the window handle for the WM_LBUTTONDOWN/UP messages. Application.DoEvents() in your test loop to get the event handlers to run.