Android Automation - NativeDriver

Library Configuration Tip:

  1. To run the Robotium tests, we need to select all in “Properties -> Java Build Path -> Order and Export”;
  2. Move the robotium up to top and move Android and Android Dependencies just below robotium (but still above any project).

Tips:

  1. Create the tests as JUnit tests;
  2. Under application folder, run $Android-SDK-Prefix/platform-tools/adb shell am instrument com.calculator/com.google.android.testing.nativedriver.server.ServerInstrumentation; then run $Android-SDK-Prefix/platform-tools/adb forward tcp:54129 tcp:54129
  3. Connection and port forward are easily broken, need to check them when tests fail, especially once the tests fail or code is changed.
  4. If the element, especially textfield, is not focused, you can’t input anything in it; unless you click() it before sendKeys()
  5. After input into textfield, you need to navigate back to disable keyboard, using driver.navigate().back()
  6. No api about wait(), just use Thread.sleep()
  7. Using the take screenshot method, you can only use full path

References:

  1. NativeDriver
  2. NativeDriver Wiki
  3. NativeDriver Source
  4. NativeDriver Google Groups
  5. TestNG + NativeDriver实现android的UI自动化测试
  6. How to Screen Capture On Error
  7. Windows下NativeDriver截屏功能

Attachments:

NativeDriverAndroidTests.zip