How to perform functional testing from and on Android devices? - android

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.

Related

Controlling android camera with computer

I want to be able to run a program on my desktop (C++, bash, or python would all be preferred. I have plenty of experience with those languages so no worries there) to control the camera on my android phone. (While the phone is connected to my computer via USB.)
I'm guessing I should start by looking through the android SDK docs, but not sure if that's even the place to start, because I'm assuming the SDK is to write programs for the phone itself, not writing programs to control the phone.
The only functions I need are record, stop, set zoom level, and set save filename.
Basically my question is: where should I start looking, and if you have heard of a tutorial or example that shows an easy way to do something like this, I would appreciate it.
I have a Galaxy S5, and my desktop runs Debian 8.
Thanks!

How to record touches and emulate them later on real devices (with ROOT if needed)?

Background
the monkeyRunner (and monkey) is a nice tool to test out apps.
I have an idea of using it (or something similar) to record & emulate touches (and keys).
The problem
The tool itself has some disadvantages:
needs to be run on an emulator or on a device that is connected to a PC.
needs adb.
it needs that you type it exactly what to do , which requires a lot of patience and trial&error in order to find out what to write.
has limitations on how many devices to run (since it needs to be connected to a PC).
needs customization of each device (where to put the touches, for example).
not intuitive, especially for QA teams.
The question
Is it possible to use this tool in order to record touches (and keys) and later emulate them, even without using a computer? Maybe using a rooted device?
There are some advantages to having this ability:
It can help running tests on the go, and help QA teams to do tests in an easier way. You could have a tool that help you record macros for tests that will run on each new version, and some tests that are a bit random, ...
It can help making cool apps for power users, for example in order to help other people, remote control, macros,...
since you don't have to connect the device to the computer, you can run the macros on your app on multiple devices simultaneously .

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.

How to record all touch and acclerometer on an Android device in ALL apps

I am currently working on a research project which involves people playing games on an Android device. I am hoping to be able to write an android app that records the accelerometer and touch events. I would like my users to be able to play games such as angry birds, whilst I record their touching data.
I understand that this type of data collection is possible from inside the app, but is it possible from outside the app? (perhaps via an app running in the background?)
If this is not possible, are there alternatives? (I believe I could theoretically go into the android OS source code and make this happen?)
I understand that this type of data collection is possible from inside the app, but is it possible from outside the app? (perhaps via an app running in the background?)
For touch events, no, for obvious privacy and security reasons. It used to be possible (research the term "tapjacking"), but current versions of Android finally blocked this behavior.
For accelerometer events, you can record those, because they are the same for all apps simultaneously. Bear in mind that your sampling rate may not exactly match that of the app being used.
I believe I could theoretically go into the android OS source code and make this happen?
Yes, though you would then need to turn that modified Android into a ROM mod and install it on devices.
Apps are not allowed to do this on a secured device (ie, consumer phone/tablet that has not been 'rooted').
However, depending on your needs it may be possible with the development tools connected to a computer. If you can do some moderately annoying setup before each controlled-circumstances trial, I believe you can do it on some stock devices by using the USB cable to switch ADB into wifi mode, then monitoring input events over a wireless ADB session. See
http://source.android.com/tech/input/getevent.html
That document seems to imply that 'su' is needed (which is odd as the official 'su' isn't usable by non-root users), however it works without on many stock devices.
You'd probably also want to be running logcat to figure out what application is in the foreground.

Developing on AVD vs Actual Android enabled device

I just started to learn how to program an Android applications. Coming from a C# world, one thing that bothers me greatly about Android programming is the fact that it takes forever to actually test your app because you have to fire up AVD or wait until the app is installed on your actual device whereas for Winforms/WPF applications, you just hit that debug button and everything loads within split seconds.
My first question is, which is a more preferred way of developing to maximize efficiency? Develop on AVD or an actual device? Are there any suggestions on how I can improve my development speed?
A few things, most people leave the AVD open whilst they are developing so that they don't have to wait ten minuets every time they open it, however if you have a very slow computer and this is not an option then yes it will talk a while
If you have a faster computer then AVD is likely to be less laggy, but for a completely lag free testing place, use your actual device.
If you are making games you should look into libgdx because it allows you to test your apps on your desktop, then by changing one line, export them as .apk files and test on you android device
For a lot of apps and features within apps you will be left with no option but to test on your real device. Because it can take a while moving the .apk file to the actual device, I would recommend using an on device IDE to make small edits to your code whilst testing certain hardware features such as the volume buttons or the accelerometer. As for on device IDEs I would recommend AIDE - https://play.google.com/store/apps/details?id=com.aide.ui&hl=en
On the whole, I would recommend using eclipse with AVD, for the majority of your development on the majority of your apps, but for any apps that you need hardware functions for, I would recommend using an on device IDE (search the play store for android development for more options if you don't like my recommendation). Most importantly don't list your app until you have tested it on multiple screen sizes on the AVD, and you have tested it on you physical device
Keep the AVD open, you can keep doing debugs and test on it, it will automatically close and reopen with new code, that’s how I do at least, and I am the same, came from C# no experience with Android.

Categories

Resources