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?
Step 1: Recognition of the target system. Step 2: Recognition of the inputs. Step 3: Fuzzed data Generation. Step 4: Test Execution using fuzzy data.
Fuzz testing is an automated or semi-automated testing technique which is widely used to discover defects which could not be identified by traditional functional testing methods.
Definition. Fuzz testing or fuzzing is an automated software testing method that injects invalid, malformed, or unexpected inputs into a system to reveal software defects and vulnerabilities. A fuzzing tool injects these inputs into the system and then monitors for exceptions such as crashes or information leakage.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With