views:

297

answers:

4

I would like to stress test a win32 application by sending a lot of random keystrokes to it, and I wonder if anyone could point me to some software I could use. Ideally, I should be able to specify which keystrokes can be sent, and control rate (random min/max).

A: 

Here's a pseudocode (since you didn't mention the language you're using):

  • Create an array that contains the alphabet from a-z, A-Z, 0-9 (depending on what keys you wish to send)
  • for i = 0 to NumberOfKeyStrokes
  • rand() % SizeOfArray
  • delay for rand() milliseconds (the lower the range, the faster the key strokes are)
  • send via an API or as a string

For more information on sending a keystrike to an application on windows, research the API FindWindow and SendMessage

MrValdez
Thanks but I am more looking for a tool to do this... that's why I didn't specify a language in my question. And besides that, why did you remove the "monkey" keyword on my post? this is the name of the technique: http://en.wikipedia.org/wiki/Monkey_test
Drealmer
+2  A: 

Have a look at AutoIt. It has a COM interface, so you can script it from any language that supports COM. I've written Python scripts to automate GUIs.

jrb
+1  A: 

I would use a macro software, like AutoIt, as jrbushell said, or AutoHotkey. They also allow random clicks... :-) Both are free.

PhiLho
+2  A: 

Have a look at the Fuzz Testing of Application Reliability website of the University of Wisconsin. They did a research study some years ago to test the reliability of desktop software and on that page you find a link to their FTP site providing fuzz testing tools.

I've used the fuzz-nt tool from that site for my own tests and successfully found several bugs in our application. It has no option to choose the keyboard input values (but source is provided). Instead it lets you choose from these sources of random data:

  • random keyboard events
  • random mouse events
  • random windows events (to be used with care or better not at all)
Bananeweizen