lecture on automation
TRANSCRIPT
How to organize execution of tests
on real Android devices
Misha Beshkin. DevConfu 2. Jurmala May, 2014
Agenda
● Little bit about me● A little about Nitro Nation and Creative Mobile● A lot about A.C.T.H.U.L.H.U● Qs&As
Misha Beshkin
● Was born and raised in Daugavpils, Latvia
● Studied in Daugavpils University, Faculty of Humanities.
● Moved to Tallinn in December 2003● Worked for Symantec Estonia as QA engineer
● In 2013 changed for Creative Mobile
Creative Mobile
Nitro Nation
A.C.T.H.U.L.H.U
© DreamLand Toys
Automation Controller. Tester's Hands Unloading LeadsHuman Unemployment
How it looks like?
What does it do?Download latest
orset apk
Uninstall preciously installed version
Install apk Collect logs
Run Activity
Save log for a device
How devices are added?
String apkExe = "adb"; AndroidDebugBridge.initIfNeeded(false);AndroidDebugBridge adb = AndroidDebugBridge.createBridge(apkExe, true);if (adb == null) { System.err.println("Invalid ADB location."); System.exit(1);}
Init ADB
Prerequisites:● Android SDK● DDMS library● ADB binary
How devices are added?
final List<IDevice> deviceList = new ArrayList<IDevice>();AndroidDebugBridge.addDeviceChangeListener(new AndroidDebugBridge.IDeviceChangeListener() {
@Override public void deviceChanged(IDevice device, int arg1) { // not implement }
@Override public void deviceConnected(IDevice device) {
System.out.println(String.format("%s connected", device.getSerialNumber())); Map<String, String> properties = null;
try { properties = getDeviceInformation(device); } catch (Exception e) { e.printStackTrace(); } if (properties!=null) { deviceList.add(device); } }
@Override public void deviceDisconnected(IDevice device) { System.out.println(String.format("%s disconnected", device.getSerialNumber()));
}});
Add devices to list
Execute shell command
ShellOutputReceiver shellOutputReceiver= new ShellOutputReceiver("MemTotal");device.executeShellCommand("cat /proc/meminfo", shellOutputReceiver);String memory = shellOutputReceiver.toString();
Get RAM info
ShellOutputReceiver shellOutputReceiver= new ShellOutputReceiver("Processor");device.executeShellCommand("cat /proc/cpuinfo", shellOutputReceiver);String cpu = shellOutputReceiver.toString();
Get CPU info
ShellOutputReceiver shellOutputReceiver= new ShellOutputReceiver("GLES:");device.executeShellCommand("dumpsys", shellOutputReceiver);String gpu = shellOutputReceiver.toString();
Get GPU info
ShellOutputReceiverpublic class ShellOutputReceiver implements IShellOutputReceiver { private String result; private int checkRunning = 0; private String grepPattern = "";
public ShellOutputReceiver(String grepPattern) { this.grepPattern = grepPattern; }
@Override public void addOutput(byte[] bytes, int i, int i2) { String result = ""; result = new String(bytes); String[] array = result.split("\r\n"); for (int i=0; i< array.length; i++) { if (array[i].contains(grepPattern)) { this.result = array[i]; break; } } }
@Override public void flush() { }
@Override public boolean isCancelled() { return false; }
@Override public String toString(){ return result; }}
Show Time
Questions & Answers
Thank you for attention
http:// misha.beshkin.lvmail:// [email protected]
facebook:// beshkintwitter:// midbarphone:// +372-53454663