当种子相同时,Android的猴子生成的事件不一样

时间:2016-08-18 07:48:55

标签: android monkeyrunner

我使用Monkey对我的应用进行压力测试。在https://developer.android.com/studio/test/monkey.html上我读到了:

-s <seed>   Seed value for pseudo-random number generator. If you re-run the Monkey with the same seed value, it will generate the same sequence of events.

但是当我用相同的种子运行Monkey两次然后比较输出时,我的ACTION_UP和ACTION_DOWN事件的坐标都不相同。

输出#1

:Monkey: seed=1470246130093 count=50
:AllowPackage: sample1.com.sample_1
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Event percentages:
//   0: 7.5%
//   1: 5.0%
//   2: 1.0%
//   3: 7.5%
//   4: 50.0%
//   5: -0.0%
//   6: 12.5%
//   7: 7.5%
//   8: 1.0%
//   9: 1.0%
//   10: 0.5%
//   11: 6.5%
:Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=sample1.com.sample_1/.MainActivity;end
    // Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=sample1.com.sample_1/.MainActivity } in package sample1.com.sample_1
:Sending rotation degree=2, persist=true
:Sending rotation degree=3, persist=true
:Sending rotation degree=3, persist=true
:Sending rotation degree=0, persist=true
:Sending rotation degree=0, persist=true
:Sending rotation degree=1, persist=false
:Sending rotation degree=2, persist=true
:Sending rotation degree=2, persist=true
:Sending rotation degree=0, persist=true
:Sending Trackball (ACTION_MOVE): 0:(2.0,1.0)
:Sending rotation degree=2, persist=false
:Sending rotation degree=3, persist=true
:Sending rotation degree=0, persist=false
:Sending rotation degree=1, persist=false
:Sending rotation degree=0, persist=true
:Sending Touch (ACTION_DOWN): 0:(1091.0,998.0)
:Sending Touch (ACTION_UP): 0:(1106.5758,994.1529)
:Sending rotation degree=3, persist=false
:Sending Trackball (ACTION_MOVE): 0:(-2.0,3.0)
Events injected: 50
:Sending rotation degree=0, persist=false
:Dropped: keys=0 pointers=0 trackballs=0 flips=0 rotations=0
## Network stats: elapsed time=241ms (0ms mobile, 0ms wifi, 241ms not connected)
// Monkey finished

输出#2

:Monkey: seed=1470246130093 count=50
:AllowPackage: sample1.com.sample_1
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Event percentages:
//   0: 7.5%
//   1: 5.0%
//   2: 1.0%
//   3: 7.5%
//   4: 50.0%
//   5: -0.0%
//   6: 12.5%
//   7: 7.5%
//   8: 1.0%
//   9: 1.0%
//   10: 0.5%
//   11: 6.5%
:Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=sample1.com.sample_1/.MainActivity;end
    // Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=sample1.com.sample_1/.MainActivity } in package sample1.com.sample_1
:Sending rotation degree=2, persist=true
:Sending rotation degree=3, persist=true
:Sending rotation degree=3, persist=true
:Sending rotation degree=0, persist=true
:Sending rotation degree=0, persist=true
:Sending rotation degree=1, persist=false
:Sending rotation degree=2, persist=true
:Sending rotation degree=2, persist=true
:Sending rotation degree=0, persist=true
:Sending Trackball (ACTION_MOVE): 0:(2.0,1.0)
:Sending rotation degree=2, persist=false
:Sending rotation degree=3, persist=true
:Sending rotation degree=0, persist=false
:Sending rotation degree=1, persist=false
:Sending rotation degree=0, persist=true
:Sending Touch (ACTION_DOWN): 0:(1635.0,510.0)
:Sending Touch (ACTION_UP): 0:(1650.5758,506.1529)
:Sending rotation degree=3, persist=false
:Sending Trackball (ACTION_MOVE): 0:(-2.0,3.0)
Events injected: 50
:Sending rotation degree=0, persist=false
:Dropped: keys=0 pointers=0 trackballs=0 flips=0 rotations=0
## Network stats: elapsed time=428ms (0ms mobile, 0ms wifi, 428ms not connected)
// Monkey finished

为什么呢?我期望看到相同的事件,因此,相同的输出

0 个答案:

没有答案