Library Configuration Tip:
- To run the Robotium tests, we need to select all in “Properties -> Java Build Path -> Order and Export”;
- Move the robotium up to top and move Android and Android Dependencies just below robotium (but still above any project).
Tips:
- Create the tests as JUnit tests;
- 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
- Connection and port forward are easily broken, need to check them when tests fail, especially once the tests fail or code is changed.
- If the element, especially textfield, is not focused, you can’t input anything in it; unless you
click()
it beforesendKeys()
- After input into textfield, you need to navigate back to disable keyboard, using
driver.navigate().back()
- No api about
wait()
, just useThread.sleep()
- Using the take screenshot method, you can only use full path
References:
- NativeDriver
- NativeDriver Wiki
- NativeDriver Source
- NativeDriver Google Groups
- TestNG + NativeDriver实现android的UI自动化测试
- How to Screen Capture On Error
- Windows下NativeDriver截屏功能