How to automate basic sanity on android? - android

My aim is to run an automated test to check the bare minimum on my android build once its loaded on the device
Boot to the Homescreen
Turn WIFI on/off
Turn BT on/off
Start Camera - take snapshot
Switch to Camcorder - take a short video
Run audio and video
Log to a file what passed and what failed.
I would like to do this entirely using adb.exe on windows host.
What I want to know is how do I test each of the above options from adb shell command line?
Thanks in advance!

Consider using Android Compatibility Test Suite (CTS).
For example, after you've downloaded the CTS test package, to test the Camera you could issue a command on the host that looks like the following:
./cts-tradefed run cts --class android.hardware.cts.CameraTest

Related

Printing log-data with ADB/Unity and OculusGo/gearVR

I have a problem while developing VR-Applications. I am creating a game, and the only way to test it is building and uploading it on the Oculus Go. I could live with that, right until now where I have a problem with the behaviour of the controller. I want to log some sensor data, but due to the fact that the app is builded and started on the device, Unity can of course not read any output from it.
My workaround is to display the log data in the VR, which is really annoying. I was thinking about something like running ADB on the computer while the app is running (Oculus Go has the same core as the GearVR does, Android based), but I couldn't manage that either, mainly because the code is written in C# in Unity and I don't know if its translated correctly to the Android Log Commands.
This can be used for debugging and seeing the output from Debug.log() from the oculus go:
adb logcat -s Unity ActivityManager PackageManager DEBUG *your log tag here*

How to use apps on Android via adb tools?

I am using Android 6 Marshmellow.
I need to perform a local backup on Whatsapp without access to the screen. The motherboard has been damaged possibly beyond repair. The net result: Nothing displays on the screen. I have tried Windows 10 programs that display the Android screen in a window on PC but they don't work - possibly because the phone is failing to produce an output in the first place.
One program I used is this but the screenshot that the java app takes is pitch black. Hence my assumption the motherboard is incapable of producing a display at all.
Therefore, I would like to know if there is a way to execute app-specific commands such as telling Whatsapp to create a local backup via adb tools. So use Whatsapp via the Windows command line, through adb, as you can on Linux.
I cannot interact with the display; touch inputs are not registered. It has a password but the phone is not encrypted. My Windows 10 PC is a trusted PC and the phone has developer tools on.
More info here.
If you set that phone up for development and you can use adb commands to install an app (and send other intents), you might be able to try this out: Vysor
You can test this by simply turning on your phone, plug it in via USB cable and then run "adb devices" on your PC. Make sure adb.exe is in your Window's path.
Download the Windows app, install it and run it. Then plug in your phone. If this phone has developer options enabled and has been white-listed for the particular PC you're using, then it should allow the Windows app to install the Vysor Android app and start it. Once that happens, it should be able to connect and you'll see the phone's screen on your PC. Try it out with a working phone first if you like.
Good luck!
Find your emulator device ID. Run C:>adb devices
Find the package you want to debug. Run adb shell pm list packages .
Set the app to debug at startup (note the -w)
Start the app in the emulator.
Connect Android Studio Debugger.
Point to source code and set breakpoints.

USB Debugging in VitualBox-hosted Android system

I have set up a virtual machine running an Android 4.4 system on VirtualBox, in a Windows 7 system, for convenience in testing an Android app I am trying to develop. What last remains, is to be able to make the guest Android OS look like it's connected to the host via USB, to be able to use USB Debugging. Is there a way to achieve that?
EDIT: By "convenience" I mean I do not have a good enough physical device at my hands at the moment, and my processor happens not to support VT-x, in which case I could just use an AVD with Android Studio. Therefore, the VirtualBox choice is the next best thing I got, until I get a new device on my hands. What has priority at the moment is to create the app's utility, looks will be taken care of later on.
If your Android system is rooted you can install Wifi ADB (or some similar application) through Android Play store and debug over TCP.
The steps can be simply:
Install Wifi ADB (from https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=es)
Execute and start service (Bettle will go to green)
Open Command line in Windows 7 machine
Run the connection command, for example:
adb connect 192.168.125.232
Test device connection with
adb devices
Enjoy testing your application!

Android onTrimMemory testing

How can I simulate TRIM_MEMORY_RUNNING_LOW in Genymotion or on a real device? Can I send a command from Android Studio or per command line (with adb)?
I really need to test it, while my app is in front and not in background.

Android CTS on 4.0.3 list device is showing device as unavailable

I am trying to run CTS on Android 4.0.3. In the process i am facing following issue.
Cts-tf > list devices is showing my device state as unavailable. As per CTS manual, this means the device is not responding to adb commands. But the commands works just fine for me when i try to run them manually. I would like to know what all can be the possible cause of device being treated as unavailable. Also if someone can suggest me more pointer to debug the issue further.
Other information.
I have verified that all the settings are done as discussed in CTS manual.
I am connecting adb using ethernet ( adb connect IP_addr) and not usb.
I am running cts on windows host ( in case this matters).
I encountered the same problem under Linux and found it is related to the environment variable ANDROID_SERIAL. If ANDROID_SERIAL is not set or is different from the serial of the device to be tested, the device will show up as "Unavailable"
This behavior doesn't make much sense, as CTS allows to distribute the tests on several devices (--shards) and also has an option to specify the serial number of the device to test

Categories

Resources