Can I use MonkeyRunner tool to work in mobile as application - android

I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner? Also, I have the impression that it only works with SDK?
I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?
If yes, please provide me help on how to start writing python for mobile, and how to make project for android in Python. I have used Eclipse for java for android, but not for python.

I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner?
From your development machine, yes. Per your question title, you cannot use MonkeyRunner on a device.
Also, I have the impression that it only works with SDK?
Yes.
I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?
Fortunately, no, as this would be a massive security hole.

I have the impression that it only works with SDK?
MonkeyRunner uses adb (Android Debug Bridge) which comes with the SDK. However, if you install the SDK, that doesn't mean you also need to start it. You just need the adb tool to interact with your device.
I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner?
For key events, here is the list of key events supported by adb:
http://developer.android.com/reference/android/view/KeyEvent.html
These can be directly through adb and will the handled by the app that you have in foreground at that moment, or in some cases, like the Home button, will cause the Task Manager to appear.
If you do wish to use these for functional testing of your app, i recommend avoiding mnemonic menu selection, because menus change, and your scripts will require change also. :)
For Touch events i can recommend you ViewClient or Robotium. Personally, i prefer ViewClient, because it's easier to use.
http://dtmilano.blogspot.ro/2012/02/monkeyrunner-interacting-with-views.html
Mind you that ViewClient requires monkeyrunner. In its source, monkeyrunner is imported:
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?
You want to use monkey to do this.

Related

How to perform functional testing from and on Android devices?

Coming from a desktop and web background, I am familiar with tools that allow me to record mouse movements and keystrokes for Functional test.
What for Android apps? Is there any similar tool or tools? I assume with a device connected to your PC/Mac (emulator), but also simply on the device itself.
For the later, which is what I'm trying to accomplish, I would like to be able to record movements on the screen (just as in the eclipse emulator), i.e. swiping up, down, button on press, on release, etc., and simply have it run on the device itself without being connected to a computer, similar to being able to record a script (functional) and run it over and over, having this installed as an app on the device to allow me to record and run functional scripts as an overlay on top of an app in development?
Like being able to run something like MonkeyTalk directly on the device.
Think of being able to record and run Selenium functional scripts directly on and from the device.
Is there an overlay type of idea that would work? I've heard there are some security risks in this.
Looking for a solution please.
I suppose Espresso Test Recorder is exactly what you are looking for.

How to globally record touches & keystrokes on Android device?

I've noticed some apps allow to record what the user touch on the device (all touch events and characters being entered) globally, to be later saved in macros you can launch (meaning emulate) ?
This could really be useful for performing the same test on multiple devices and on multiple versions of apps, especially apps that have a lot of steps to check.
How do such apps do this?
Is it possible to achieve it even on non-rooted devices? Maybe by using ADB (and connected to a PC) ?
My guess about emulating the touches is that they do use ADB as shown here, but how can you record touches and keys, especially globally ?
What worked for me was to turn on SHOW TAPS in the developer settings.

Way to Automate button clicks of an Android Application

Is there a way to automate the clicking (opening,clicking certain button of the application and finally closing it) with some script or an android application.
Depends on what you're trying to do. For UI testing of your app you can use the build-in support, have a look at http://developer.android.com/training/activity-testing/activity-ui-testing.html or perhaps look into the UI automation tool.
If what you want to do is emulate user events on any given app, you could use adb to send key or touch events, but it would be a on a very low level
For example:
adb shell input keyevent 3
Would emulate pressing the home key.
You could also do
adb shell input tap 50 50
to emulate a touch event at the given coordinate.
You can use uiautomator (requires API 16+).
Robotium (which also uses the Android testing framework) is another great testing framework for UI. Same goes for Espresso. You can then write JUnit 3 tests for your app.

Fake mouse and keyboard input on Android

Is there are way to fake mouse and keyboard input on Android?
I developed an application for controlling computers with a smartphone client and since smart TVs become more interesting for people I would also be very interested in providing a server for Android.
I already discovered monkeyrunner but I'm not sure whether this is really what I want since it is a development tool. A native way would be far more attractive.
Has anyone already experimented with this? I use Qt so a C++ way would be great. I have also seen someone faking key inputs per command line is there a way to execute command line commands in an Android application?
Is there are way to fake mouse and keyboard input on Android?
Only via custom firmware, a rooted device, or via the Android SDK tools. Apps cannot attack other apps via "fake mouse and keyboard input" for obvious security reasons.
I have also seen someone faking key inputs per command line is there a way to execute command line commands in an Android application?
Fortunately, that will not work, unless you run as root.

Is it possible to simulate keyboard events in IOS and Android?

I would like to write some sort of macro app that presses keys. Would this be possible on IOS and/or Android?
Yes, for android, have you tried MonkeyRunner
The monkeyrunner tool provides an API for writing programs that
control an Android device or emulator from outside of Android code.
With monkeyrunner, you can write a Python program that installs an
Android application or test package, runs it, sends keystrokes to it,
takes screenshots of its user interface, and stores screenshots on the
workstation.

Categories

Resources