Hacker News new | ask | show | jobs
by ben_w 848 days ago
Reminds me of something I learned of over a decade ago:

   isUserAMonkey

   Added in API level 8

   public static boolean isUserAMonkey ()

   Returns "true" if the user interface is currently being messed with by a monkey.
- https://developer.android.com/reference/android/app/Activity...
1 comments

I wonder why this exists.

What is this code for. How would they even know its a monkey?!

I'm sure its a joke of sorts, or clever moniker if you want to be charitable, but unclear to me in any case

A quick Kagi search revealed that this checks if the user is a simulated user in for stress tests:

https://developer.android.com/studio/test/other-testing-tool...

My guess is that the name shares its etymology with other Monkey references in tech, like Chaos Monkey. Where a being that has no understanding of the purpose of anything in the environment is given access to the environment and allowed to wreak havoc as a form of resilience testing.

This monkey appears to generate system events and user input events in a pseudo-random (deterministic) way to help with fuzzy-like testing of an app.