0
コマンドラインからuiautomator 2.0をテストします。私の手順は以下の通りです:uiautomator 2.0を使用してテストを実行できませんでした。
が計測プロジェクトを作成し、以下のコードは、次のとおりです。
package com.android.uiautomator.client; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import android.app.Application; import android.app.Instrumentation; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import android.test.ApplicationTestCase; @RunWith(AndroidJUnit4.class) public class Initialize { @Test public void testStartServer() { System.out.println("this is the test"); } }
使用gradlewは、AndroidエミュレータにテストAPKをインストールし、テストAPK
を生成します
adb shell push ${apkPath}/test.apk /data/local/tmp/com.android.test adb shell pm install -r /data/local/tmp/com.android.test
テストa pkが正常にインストールされました。そして、私はインストールされたAPKを見つけることができます。インストール後
adb shell pm list packages
、私はエミュレータで計測をチェックし、私はテストAPKについての計測を見つけるcant't。これは、コマンドの実行に失敗につながる:
adb shell am instrument -e class com.android.uiautomator.client.Initialize -w com.android.uiautomator.client.test/android.support.test.runner.AndroidJUnitRunner
はそう、私は混乱しています。テストAPKをインストールした後に計測器を見つけることができないのはなぜですか?
はい、私はそれを試しました。しかし、私はまだインストールされたテストapkのための計測器を見つけることができません – kobe990
その後、計測器はインストールされていないか、またはそのパッケージ用ではありません、grepフィルタを削除し、 –