2013-11-26 74 views
1

我試圖通過Eclipse運行我的測試類作爲Android Junit測試,然後它的提供無法找到測試類的excpetion。運行Android Junit時找不到測試類異常

我已經正確地提到了我的生產性代碼包的入侵目標包。

下面是Android清單

<?xml version="1.0" encoding="utf-8"?> 

<uses-sdk android:minSdkVersion="15" /> 

<instrumentation 
    android:name="android.test.InstrumentationTestRunner" 
    android:targetPackage="com.abc.android" /> 

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 
    <uses-library android:name="android.test.runner" /> 
</application> 

我還通過構建路徑,它正確地包括目標的類,該類文件可以發現檢查。

無法找到問題所在。

感謝和問候, Saurav

+0

哪裏的Android junit測試挑選它的類?...我preseume它的bin /類是在構建路徑...不知道是什麼問題 – saurav

回答

0

你檢查您是否正確設置?看到這個鏈接 http://developer.android.com/tools/testing/activity_test.html

你也可以考慮使用Robotium進行測試。 https://code.google.com/p/robotium/

+0

我做了...我忘了提及我使用maven來建立我的項目 – saurav

+0

https://code.google.com/p/maven-android-plugin/wiki/AutomateAndroidTestProject你可以看看那個鏈接 –

+0

我也試圖用Maven項目解決這個問題。我跟着這個鏈接解釋瞭如何使用Maven成功測試,但沒有解釋如何在這個變化之後從Eclipse運行測試。 – Ika

1

我刪除了我的項目並從我的源代碼回購中獲得了最新版本。

然後我跑我的測試它確實工作。

但想知道爲什麼問題出現在那裏。

哪裏的Android JUnit測試撿起來從類Eclipse中運行時?...我相信其斌/類是在構建路徑...想不通的是什麼問題