jonathanpenn / ui-auto-monkey

UI AutoMonkey is a simple stress testing script for iOS applications that runs in UI Automation and Instruments. Grass fed. Free range.
http://cocoamanifest.net
MIT License
1.47k stars 249 forks source link

Handlers would only be activated after one minutes run. #21

Open truebit opened 9 years ago

truebit commented 9 years ago

I set monkey to run in 2 hours (a.k.a 120 minuete), and I also created a ButtonHandler. I add the logs in buttonhandler, I found that the ButtonHandler was never triggered until one minutes running.

See the first and last line in the log. the last line is the log I added in buttonhandler. that's its first appearance

2015-05-25 09:31:57 +0000 Debug: 119.99991666666666 minutes left to run.
2015-05-25 09:31:57 +0000 Debug: target.tapWithOptions({x:"230", y:"200"}, {touchCount:"1", duration:"0", tapCount:"1"})
2015-05-25 09:31:57 +0000 Debug: target.tapWithOptions({x:"187", y:"381"}, {touchCount:"1", duration:"0", tapCount:"1"})
2015-05-25 09:31:58 +0000 Debug: target.tapWithOptions({x:"55", y:"159"}, {touchCount:"1", duration:"0", tapCount:"1"})
2015-05-25 09:31:58 +0000 Debug: target.tapWithOptions({x:"113", y:"186"}, {touchCount:"1", duration:"0", tapCount:"1"})
2015-05-25 09:31:58 +0000 Debug: target.tapWithOptions({x:"179", y:"136"}, {touchCount:"1", duration:"0", tapCount:"1"})
2015-05-25 09:31:58 +0000 Debug: target.tapWithOptions({x:"151", y:"527"}, {touchCount:"2", duration:"0", tapCount:"1"})
2015-05-25 09:31:58 +0000 Debug: target.tapWithOptions({x:"3", y:"1"}, {touchCount:"1", duration:"0", tapCount:"1"})
2015-05-25 09:31:58 +0000 Debug: target.tapWithOptions({x:"156", y:"217"}, {touchCount:"1", duration:"0", tapCount:"1"})
2015-05-25 09:31:59 +0000 Debug: target.tapWithOptions({x:"58", y:"75"}, {touchCount:"1", duration:"0", tapCount:"1"})
2015-05-25 09:31:59 +0000 Debug: target.tapWithOptions({x:"67", y:"456"}, {touchCount:"1", duration:"0", tapCount:"1"})
2015-05-25 09:31:59 +0000 Debug: ButtonHandler 返回 find result is false
truebit commented 9 years ago

I added some verbose output, found that the length of monkey.config.conditionHandlers is 0 when RELEASE_THE_MONKEY() method start running

my code is like:

#import "ui-auto-monkey/UIAutoMonkey.js"
#import "ui-auto-monkey/buttonHandler.js"
monkey = new UIAutoMonkey()
monkey.config.minutesToRun = 60 * 2; 
monkey.config.checkTimeEvery = 60; 
monkey.config.numberOfEvents = false; 

var handlers = [ ];
handlers.push(new ButtonHandler("Back", 30, false)); 
monkey.config.conditionHandlers = handlers;

// Release the monkey!
monkey.RELEASE_THE_MONKEY();
BruceBGordon commented 9 years ago

Did you comment out the "RELEASE_THE_MONKEY() code in the orginal UIAutoMonkey.js file"?