Skip to main content
Samsung Developer Program

Monkey Test

This test module subjects your app to randomly selected inputs of 5 different types of automated unit tests.  If your app fails one of the unit tests, then testing stops and your app has failed the entire test module. If your app passes 1000 unit tests, then it has passed the entire test module. 

When each unit test is conducted, one of the unit test's input events is sent to the test device.  The test module monitors and logs these input events and the resulting events that indicate either: a) your app properly managed the input event and continued operation, or b) your app crashed or did not respond.

Each different unit test randomly sends one of the following input events to the test device:

  • Touch                            Touch coordinate events (to simulate a user tapping the device screen)
  • Motion                         Up and down events (to simulate a user clicking up and down UI buttons)
  • Trackball                      Random continuous movements (to simulate a user dragging UI elements or using a UI trackball or similar feature)
  • Navigation                  Up, down, left, and right events (to simulate a user clicking up, down, left, and right UI buttons)
  • System Key                Home, back, and volume control key events (to simulate a user clicking associated UI buttons)

 

Test results consist of pass / fail results and logged unit test events (unit test input events and resulting events.

For more details about the Monkey Test, see https://developer.android.com/studio/test/monkey.html

 

Test Sequence

  1. The module test randomly selects and applies the first unit test input event.
    1. The module test logs the input and resulting events.
    2. If your app crashes or does not respond, your app fails the unit test and module testing stops.
       
  2. If your app continues operation, the module test randomly selects and applies the next unit test input event.
    1. The module test logs the input and resulting events.
    2. If your app crashes or does not respond, your app fails the unit test and module testing stops.
       
  3. The random sequence of selecting and applying input events continues until your app fails or it is subjected to and passes 1000 unit tests of ALL different types.

 

Test Results

The following results are available by clicking the Monkey_Test link in the Test Results Summary page (summary.xml), or by opening the Monkey_Test.xml file in the unzipped file directory.  In the test results page, you can filter the displayed the results of each module test case to show all or only those results that failed or were blocked.

  Test_Results_Monkey.png

 

Case ID

Unique name of the module's test case

Purpose

Verify whether app properly responds to 1000 random input events, or app crashes or does not respond.

Status

Current state of testing the app via the test case:

Completed     All testing has finished.

Result

Fundamental outcome of running the test case:

Passed        App was subjected to and properly responded to 1000 unit tests.

Failed         App did not properly respond to 1 of the unit tests.

Blocked      An internet connection could not be established OR the test device could not connect to the test server.

Comment

Information about the testing and test results
NOTE:  Each test results in only 1 of the following.
 

  • App properly responded to 1000 input events.
  • App crashed or did not respond after an input event of a unit test.

 

Log/Attach

Files with test case results data and information:

Log or Attachment         Link to test log (see below)

 

 

Test Log

Upon test completion, the test result log file  MonkeyTest_monkeyEventInjection_random_event_injection.txt
is generated and available via the Log link.

Test_Results_Monkey_Log.png

 

The test result log contains the following results.

Monkey

Fundamental monkey test parameters:

seed      Value used to determine the sequence of unit tests

count    Maximum number of unit tests to be applied

AllowPackage

App package name that is allowed for monkey testing

IncludeCategory

Additional information about the action executed

For example, CATEGORY_LAUNCHER means the action should appear in the Launcher as a top-level application.  CATEGORY_ALTERNATIVE means the action should be included in a list of alternative actions the user can perform on a piece of data.

Event percentages

For each type of unit test, the number of times that unit tests of that type were applied to the app DIVIDED BY the total number of times that ALL units tests were applied

Sending [Type (Input Event)]

For a unit test, the type, the pseudo-random stream of input event types applied (keystrokes, touches, or gestures)

Events injected

Number of unit tests applied to the app

Network stats

Information about the network connection times during  the test

//Monkey finished

Indicates the end of all reported Monkey Test results.

  • Was this article helpful?