Android testing: Waited for the root of the view hierarchy to have window focus

This error can happen when a system dialog is displayed — like “Power Off” or “Unfortunately, Launcher has stopped” (a background app crashed) — and you try to run an Espresso unit test whilst that dialog is visible. Image credit: Android 4.0 emulator always has a crashing Launcher? You can workaround it in code by … Read more

Is there a way to get current activity’s layout and views via adb?

Use adb shell uiautomator dump command: Usage: uiautomator <subcommand> [options] Available subcommands: help: displays help message runtest: executes UI automation tests runtest <class spec> [options] <class spec>: <JARS> < -c <CLASSES> | -e class <CLASSES> > <JARS>: a list of jar files containing test classes and dependencies. If the path is relative, it’s assumed to … Read more

Set different minSdkVersion for testAndroid than for main app

I got this from the new testing template from Google. Create a new AndroidManifest.xml file in your test or androidTest folder. <?xml version=”1.0″ encoding=”utf-8″?> <manifest xmlns:tools=”http://schemas.android.com/tools” package=”your.package.name”> <uses-sdk tools:overrideLibrary=”android.support.test.uiautomator.v18″/> </manifest>

Android Testing: UIAutomator vs Espresso

Actually, you don’t need to choose. UIAutomator and Espresso use the same instrumentation runner, so you can use commands from both of them in a single test. Espresso has variety of matchers, assertions and actions on UI, that automator doesn’t have: Espresso Cheat Sheet Espresso is running in separate thread and it is really fast … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)