android單元測試除了清單檔案還有什麼限制嗎?
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void testSOmething() throws Exception {
assertEquals("a", "a");
}
@Test
public void testSOmething1() throws Exception {
assertEquals("a", "a");
}
}
運作testSOmething1方法就綠條
隻要運作testSOmething方法就報錯
Testing started at 0:37 ...
11/22 00:37:56: Launching testSOmething()
No apk changes detected since last installation, skipping installation of D:\workpace\Locked\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop com.aa.safe.locked
No apk changes detected since last installation, skipping installation of D:\workpace\Locked\app\build\outputs\apk\app-debug-androidTest.apk
$ adb shell am force-stop com.aa.safe.locked.test
Running tests
$ adb shell am instrument -w -r -e debug false -e class com.aa.safe.locked.ExampleInstrumentedTest#testSOmething com.aa.safe.locked.test/android.test.InstrumentationTestRunner
Client not ready yet..
Started running tests
Test running failed: Unable to find instrumentation info for: ComponentInfo{com.aa.safe.locked.test/android.test.InstrumentationTestRunner}
Empty test suite.
Unable to find instrumentation info for: ComponentInfo
sof上檢視有人把多建了一級包能解決這個報錯?
這是什麼原理啊
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.aa.safe.locked"
minSdkVersion 10
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}
相關閱讀:
vue.js中怎麼解綁自定義指令?
擷取mysql行資料的時候,如果列的順序是亂的,會影響效率嗎?
請教thinkphp函數問題
pdo和thinkphp查詢出來的資料int類型也是String,其他架構也這樣把?
webpack dev server 不是會在記憶體中生成 bundle.js 嗎?
typecho調用熱門文章(按點選排序)?
segmentfault這種布局方式是用的什麼?
jni生成的char*在NewStringUTF時報錯
vue.js級聯循環問題
[email protected]中文亂碼
cookie頁面跳轉問題
Laravel的blade模闆if表達式有兩個條件怎麼寫?
resourcetree中的拉取和擷取有什麼差別
關于多對多表結構設計的問題,如何設計表結構實作一次查詢擷取到完整結果?
left,margin-left的使用場景有什麼差別?
angularJS在Android WebView中無法正常調背景接口
go如何把資料庫裡實體的html 轉成正常的html
php中json資料處理的問題
京東app下面的table背景怎麼實作的?
ios微信分享給朋友,分享給android手機無法顯示‘分享标題’