麻烦大神帮我看看,在 pc 连接真机执行时,报 no tests were found. 我的安卓手机版本为 7.1.
Running tests
Test running startedTest running failed: No test results
Empty test suite.
Gradle 配置:
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.pingan.myapp1"
minSdkVersion 18
targetSdkVersion 28
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(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.+'
compile files('libs/espresso-contrib-2.2-release-no-dep.jar')
compile files('libs/espresso-core-2.2-release-no-dep.jar')
compile files('libs/espresso-idling-resource-2.2-release-no-dep.jar')
compile files('libs/espresso-intents-2.2-release-no-dep.jar')
compile files('libs/espresso-web-2.2-release-no-dep.jar')
compile files('libs/exposed-instrumentation-api-publish-0.3-release-no-dep.jar')
compile files('libs/guava-18.0.jar')
compile files('libs/hamcrest-core-1.3.jar')
compile files('libs/hamcrest-integration-1.3.jar')
compile files('libs/hamcrest-library-1.3.jar')
compile files('libs/javawriter-2.1.1.jar')
compile files('libs/javax.annotation-api-1.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/jsr305-2.0.1.jar')
compile files('libs/junit-4.12.jar')
compile files('libs/rules-0.3-release-no-dep.jar')
compile files('libs/runner-0.3-release-no-dep.jar')
compile files('libs/uiautomator-v18-2.1.1-release-no-dep.jar')
}
测试代码:
package com.pingan.myapp1;

+import android.app.Instrumentation;

/**


↙↙↙阅读原文可查看相关链接,并与作者交流