"Android stuido" "Monkey" "Jenkins" automated testing

Source: Internet
Author: User

Preliminary discussion on the automatic test -201709032226junit part Note description

A JUNIT4 unit test case Execution order is: @BeforeClass –> @Before –> @Test –> @After –> @AfterClass

The sequence of calls for each test method is: @Before –> @Test –> @After

@Test:把一个方法标记为测试方法@Before:每一个测试方法执行前自动调用一次@After:每一个测试方法执行完自动调用一次@BeforeClass:所有测试方法执行前执行一次,在测试类还没有实例化就已经被加载,所以用static修饰@AfterClass:所有测试方法执行完执行一次,在测试类还没有实例化就已经被加载,所以用static修饰@Ignore:暂不执行该测试方法excepted:例如:@Test(expected = Exception.class)timeout:例如:@Test(timeout = 3000)@RunWith:更改测试运行器例如:@RunWith(Suite.class)  @RunWith(AndroidJUnit4.class) @RunWith(Parameterized.class)@Suite.SuiteClasses:例如:@Suite.SuiteClasses({MathTest.class, BugMathTest.class})
Test suite @runwith (suite.class) parametric test @runwith (parameterized.class) Monkey parameter description
1.-help View Help for monkey example: adb shell monkey-help2.-p Specifies the package name of the application being tested: adb shell monkey-p com.  Ucmobile.x86 100 If you want to specify more than one package name, each package name is followed by a-p example: adb shell monkey-p packagename1-p packageName2 1003. Count set number of instances of execution: adb shell monkey 1004.-s sets the number of seeds (equivalent to setting a path because Monkey is a random event, so you need to set the same seed value for the regression path to match) example: adb shell Monkey 1  00-s 5 If you want to reproduce the path of the above example, the next execution of-S must also set the time interval for each random event (in milliseconds) for 55.--throttle: adb shell monkey---throttle 5006.--throttle times --randomize-throttle set random time interval interval example: adb shell monkey--throttle--randomize-throttle Description: Execute 100 Monkey random events, per event Interval between 0 and 500 milliseconds is not fixed 7.-v set log level up to (default one-V) example: adb shell monkey-v 100 For more detailed logs can be added multiple-V, up to 3 examples: adb shell monkey-v-v-v 1008.-- Ignore-crashes run in ignore crash, encountered crash still run the following events ran out example: adb shell monkey--ignore-crashes-v 1009.--ignore-timeouts Run ignored ANR, encountered a NR still runs the following events: adb shell Monkey--ignore-timeouts-v 10010. Set the percentage of events, all percentages added up to no more than 100% 0: Touch event percentage, i.e. parameter--pct-touch 1: Sliding event Hundred Ratio, i.e. parameter--pct-motion 2: Scale event percentage, i.e. parameter--pct-pinchzoom 3: Trackball event percentage, i.e. parameter--pct-trAckball 4: The screen rotation event percentage, which is the parameter--pct-rotation 5: The basic navigation event percentage, which is the parameter--pct-nav 6: The main navigation event percentage, which is the parameter--pct-majornav 7: System event percentage, which is the parameter--pc T-syskeys 8:activity Start Event percentage, which is the parameter--pct-appswitch 9: The percentage of keyboard rollover events, which is the parameter--pct-flip 10: Other event percentage, i.e. parameter--pct-anyevent example: ADB shel L Monkey--pct-touch 20-v 10011.--ignore-native-crashes Ignore the exception of the monkey itself until the event is completed example: adb shell monkey--ignore-native-cras HES-V 100

Monkey Log Analysis

1.monkey:seed=1470511671524 the seed value and number of random events executed by Count=100monkey 2. Allowpackage:com.    Ucmobile.x86 can run package name 3.//Event percentages://0:15.0%//1:10.0%//2:2.0%//3:15.0%//4:-0%// 5:-0%//6:25.0%//7:15.0%//8:2.0%//9:2.0%//10:1.0%//11:13.0% percentage of assigned events, event numbers can refer to part two 4. Event 0: Touch Event sending Touch (Action_down): 0: (572.0,1105.0) sending Touch (ACTION_UP): 0: (576.20734,1105.024) 5. Event 1: Sliding event sending Touch (Action_down): 0: (233.0,761.0) sending Touch (Action_move): 0: (208.49568,736.34766) Sending Touc H (Action_move): 0: (202.7063,729.8338) sending Touch (Action_move): 0: (183.89723,722.677) sending Touch (ACTION_UP): 0: ( 174.83568,721.8229) 6. Event 2: Scaling event sending Touch (Action_down): 0: (107.0,242.0) Sending Touch (Action_pointer_down 1): 0: (10  8.14705,248.53061) 1: (270.0,262.0) sending Touch (Action_move): 0: (110.117355,252.96329) 1: (267.9937,262.25485) Sending Touch (Action_move): 0: (111.30056,261.88846) 1: (261.90106,262.58475) SendiNg Touch (Action_move): 0: (113.11743,265.60138) 1: (253.92662,263.13382) Sending Touch (action_pointer_up 1): 0: ( 113.29031,267.4419) 1: (248.60628,263.23257) 7. Event 3: Trackball event sending Trackball (Action_move): 0: (3.0,-2.0) sending   Trackball (Action_move): 0: (1.0,-1.0) 8. Event 4: Screen rotation event (hidden event) sending rotation degree=0,persist=true9. Event 5: Navigation events (up or down) Sending key (Action_down): +//KEYCODE_DPAD_LEF10. Event 6: Main navigation events (menu, etc.) sending key (Action_down)://Keycode_dpad _center11. Event 7: System key event (volume, Home, return button, etc.) sending key (ACTION_UP): +//Keycode_volume_down12. Event 8: Launch app event switch: #Intent; a Ction=android.intent.action.main;category=android.intent.category.launcher;launchflags=0x10200000;component= Com. Ucmobile.x86/com. Ucmobile.main.ucmobile;end13. Event 9: Keyboard events (hide display keyboard) sending Flip keyboardopen=true14. Event 10: Other keys sending key (Action_down): Keycode_enter sending Key (ACTION_UP): $//KEYCODE_ENTER15. Delay Sleeping for milliseconds

Example:
adb Shell Monkey 100
ADB shell monkey-f/mnt/sdcard/test 1
(1: Number of cycles)
-S: Randomly generated numbers

【mac】adb shell monkey -v -v -v -s 11 --throttle 300 -p [包名或者APPID] --ignore-timeouts --monitor-native-crashes --ignore-crashes 50000 >/XXXX/AndroidStudioProjects/log-sm-g9308-7.0-24-20170628.txt## 联系我

qq:94297366
Reward: Https://pan.baidu.com/s/1dSBXk3eFZu3mAMkw3xu9KQ

Public Number recommendation:

"Android stuido" "Monkey" "Jenkins" automated testing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.