android 中有自動化測試工具,monkey,可以模擬隨機按鍵
或者自己寫測試ei工具類,調用接口模擬按鍵
Android.app.Instrumentation 可以做到這樣的需求
Android.app.Instrumentation instrument = this.getInstrumentation();
instrument.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_UP);
自動測試中經常用到的還有 斷言:Assert
assertTrue("testVideoCapture", false);
斷言程序執行到這裏的使用此變量的值應該是什麼,