エミュレーターで生成された apk ファイルを実行ant clean emma debug
してインストールした後、次のコマンドを実行して単体テストを実行しています。
adb shell am instrument -w -e package org.company.projectname.test.unit -e coverage true \
-e coverageFile ProjectNameTest/bin/coverage.xml org.company.projectname.tests/com.neenbedankt.android.test.InstrumentationTestRunner'
私が使用している InstrumentationTestRunner は のサブクラスですandroid.test.InstrumentationTestRunner
。
このコマンドを実行すると、すべてのテストに合格しますが、カバレッジが生成されず、次のエラーが発生します。
Error: Failed to generate emma coverage. Is emma jar on classpath?
を使用するソリューションを探しているわけではありませんが、そのソリューションが私がそれを使用しない理由に対処できる場合を除きます。つまり、テストするパッケージ (この場合はパッケージ)ant test
を指定できるようにしたかったからです。org.company.projectname.test
unit