david_vardy
12 years agoNew Contributor
Creating a blind fuzz test: random mouse/keyboard entry.
Hi all, Our software is a fullscreen application divided into different sections. Click in different areas reveals different recorded path names etc by TestComplete. I'm interested to se...
- 12 years agoHi David,
You can use Sys.Desktop.Width, Math.floor(int) and math.random()
to simulate random clicks across the screen, something like
var xlocation = Math.floor(Math.random() * Sys.Desktop.Width);
var ylocation = Math.floor(Math.random() * Sys.Desktop.Height);
Sys.Desktop.MouseDown(1, xlocation, ylocation);
Sys.Desktop.MouseUp(1, xlocation, ylocation);
And to simulate a random key you can use windows VK Key Codes with the "Sys.Desktop.KeyDown(key)" method.
for example to generate a key between A-Z you could use something like
var randkey = 30 + (Math.floor(Math.random() * 60))
*Also don't forget to release the key using the .KeyUp method