QA Engineering/End to End Test

Android monkey test

일해라폴폴 2023. 9. 12. 15:00
반응형

AOS 앱테스트에서 이런 테스트 방법이 있다는 것만 알면 좋을듯 하다.

몽키 테스트는 앱 또는 소프트웨어의 오류를 찾기 위한 테스트 방법 사용자가 무작위로 앱의 기능을 사용하도록 하는 것으로, 초기에 테스트 인력이 없거나 랜덤한 테스트가 필요 할때, 앱이 예상치 못한 오류 상황에서도 정상적으로 작동하는지 확인하는 테스트 몽키 테스트를 통해 앱의 안정성을 높일 수 있는 방법이다

1. app 리스트 확인 하기

qatest % adb shell pm list packages

...
package:io.appium.settings
package:io.ksqatest.stage
package:com.samsung.sec.android.teegris.tui_service
package:android.auto_generated_rro_vendor__
...

2. 기본 명령어
io.ksqatest.stage 앱에 100 번의 이벤트를 실행 하라

qatest % adb shell monkey -p io.ksqatest.stage -v 100

 

결과

Users@ qatest % adb shell monkey -p io.ksqatest.stage -v 100
  bash arg: -p
  bash arg: io.ksqatest.stage
  bash arg: -v
  bash arg: 100
args: [-p, io.ksqatest.stage, -v, 100]
 arg: "-p"
 arg: "io.ksqatest.stage"
 arg: "-v"
 arg: "100"
data="io.ksqatest.stage"
:Monkey: seed=1690901294626 count=100
:AllowPackage: io.ksqatest.stage
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Event percentages:
//   0: 15.0%
//   1: 10.0%
//   2: 2.0%
//   3: 15.0%
//   4: -0.0%
//   5: -0.0%
//   6: 25.0%
//   7: 15.0%
//   8: 2.0%
//   9: 2.0%
//   10: 1.0%
//   11: 13.0%
:Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=io.ksqatest.stage/io.ksqatest.MainActivity;end
    // Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=io.ksqatest.stage/io.ksqatest.MainActivity } in package io.ksqatest.stage
    // Rejecting start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.google.android.gm/.ConversationListActivityGmail } in package com.google.android.gm
:Sending Touch (ACTION_DOWN): 0:(257.0,1756.0)
:Sending Touch (ACTION_UP): 0:(257.4969,1749.8533)
:Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=io.ksqatest.stage/io.ksqatest.MainActivity;end
    // Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=io.ksqatest.stage/io.ksqatest.MainActivity } in package io.ksqatest.stage
:Sending Trackball (ACTION_MOVE): 0:(3.0,-1.0)
:Sending Touch (ACTION_DOWN): 0:(527.0,1958.0)
:Sending Touch (ACTION_UP): 0:(535.21185,1943.4863)
:Sending Touch (ACTION_DOWN): 0:(796.0,1876.0)
:Sending Touch (ACTION_UP): 0:(802.28015,1875.9323)
    // Rejecting start of Intent { act=android.intent.action.VIEW dat=https://flux.stg.ksqatest.io/... cmp=com.sec.android.app.sbrowser/.SBrowserLauncherActivity } in package com.sec.android.app.sbrowser
:Sending Trackball (ACTION_MOVE): 0:(2.0,-5.0)
:Sending Trackball (ACTION_UP): 0:(0.0,0.0)
:Sending Touch (ACTION_DOWN): 0:(338.0,1895.0)
:Sending Touch (ACTION_UP): 0:(338.6164,1874.1932)
:Sending Touch (ACTION_DOWN): 0:(221.0,1642.0)
:Sending Touch (ACTION_UP): 0:(148.47998,1557.8242)
:Sending Touch (ACTION_DOWN): 0:(729.0,162.0)
:Sending Touch (ACTION_UP): 0:(721.9687,163.75333)
:Sending Trackball (ACTION_MOVE): 0:(-4.0,2.0)
:Sending Touch (ACTION_DOWN): 0:(493.0,487.0)
Events injected: 100
:Sending rotation degree=0, persist=false
:Dropped: keys=0 pointers=0 trackballs=0 flips=0 rotations=0
## Network stats: elapsed time=564ms (0ms mobile, 0ms wifi, 564ms not connected)
// Monkey finished

3. 시간을 2초 간격으로 이벤트를 실행

// --throttle 2000 (1초에 1000ms)
qatest % adb shell monkey -p io.ksqatest.stage --throttle 2000 -v 100

4. 기타 명령어

이벤트 카운트
(-v <event_count>): 이 옵션은 테스트 중에 Monkey가 생성할 임의 이벤트 수를 설정합니다.

스로틀
(--throttle <time_in_milliseconds>): 스로틀 옵션은 연속 이벤트 사이의 지연(밀리초)을 제어합니다. 값이 높을수록 이벤트 생성이 느려집니다.

무작위 시드
(-s <random_seed>): 이 옵션은 Monkey 테스트에 대한 임의 시드를 설정하여 동일한 시드를 사용하는 경우 이벤트 시퀀스를 반복할 수 있도록 합니다.

패키지 무시
(--pct-ignore <백분율>): 이 옵션을 사용하여 앱이 백그라운드 이벤트를 처리하는 방법을 테스트하기 위해 다른 애플리케이션(대상이 아닌 앱)으로 보낼 이벤트 비율을 지정할 수 있습니다.

Anr 충돌 허용
(--pct-anr <백분율>): 이 옵션을 사용하면 ANR(응용 프로그램 응답 없음) 충돌을 일으킬 수 있는 이벤트의 비율을 지정할 수 있습니다.

충돌 허용
(--pct-crash <백분율>): 이 옵션을 사용하면 애플리케이션 충돌을 일으킬 수 있는 이벤트의 비율을 지정할 수 있습니다.

시간 초과 허용
(--pct-activity-timeout <백분율>): 이 옵션은 대상 활동의 시간 초과를 유발할 수 있는 이벤트의 비율을 설정합니다.

보안 예외 허용
(--pct-syskeys <백분율>): 이 옵션을 사용하여 보안 예외 충돌을 일으킬 수 있는 이벤트의 백분율을 지정합니다(예: 시스템 키를 사용할 때).

디버깅
(-d 또는 --debug-no-events): 이 옵션은 이벤트를 전송하지 않고 디버그 정보를 표시합니다. 테스트 설정에서 문제를 진단하는 데 유용합니다.
반응형