Forum Discussion

david_vardy's avatar
david_vardy
New Contributor
12 years ago

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...
  • Yshippin's avatar
    12 years ago
    Hi 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