- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在学习使用 espresso 来测试我的应用程序,但是 ActivityTestRule
总是无法解决。这是我的 app/build.gradle 配置,我确定我将测试类放在 src/androidTest 中。
非常感谢您的帮助!!
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.android.teatime"
minSdkVersion 16
targetSdkVersion 27
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 'com.android.support:design:27.1.1'
compile 'com.android.support:support-annotations:27.1.1'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
// Testing-only dependencies
androidTestCompile 'com.android.support:support-annotations:27.1.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestCompile 'com.android.support.test:runner:1.0.2'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:3.0.2'
androidTestCompile 'com.android.support.test:rules:1.0.2'
}
最佳答案
我希望这对你有用。
使用
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
代替
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestCompile 'com.android.support.test:runner:1.0.2'
关于android - 无法解析符号 'ActivityTestRule',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50595971/
我已经编写了工作正常的仪器测试,但是在将依赖项升级到之后出现错误无法解决 ActivityTestRule 错误 androidTestImplementation 'com.android.supp
我在 gradle 中添加了以下依赖项: 但是还是无法导入ActivityTestRule,报错 最佳答案 看起来您正在使用 Espresso 2.2.2 中的旧依赖项。对于当前版本(Espresso
我正在学习使用 espresso 来测试我的应用程序,但是 ActivityTestRule 总是无法解决。这是我的 app/build.gradle 配置,我确定我将测试类放在 src/androi
我需要在我的 Android 应用程序中测试单个 Activity 。 ActivityInstrumentationTestCase2 的文档说: This class provides funct
我正在尝试使用 androidX espresso 库通过仪器测试来测试我的 UI。在我的年级,我有: apply plugin: 'com.android.application' apply pl
这是我的仪器测试的范围: ... import androidx.test.rule.ActivityTestRule @RunWith(AndroidJUnit4::class) @LargeTes
我修改了 ActivityTestRule 以重试执行失败的测试用例。每当测试失败时,我都需要重新启动 Activity 并重新运行执行。我已尝试调用 mActivity.finish() 但当前 A
在探索测试时,我遇到了 ActivityTestRule 和 IntentTestRule,据我所知,IntentTestRule 是 ActivityTestRule 的扩展,用于 Espresso
我正在使用 Espresso 2.1 和 ActivityTestRule,我正在寻找一种方法来在我的应用程序中调用 onCreate() 之前设置一些静态标志。 我有一些我不想在仪器测试期间调用的初
ActivityTestRule类在其构造函数中接受 initialTouchMode 参数。类(class)引用(或在线任何地方)中没有解释这一点,除非如下: initialTouchMode -
我想在测试 Activity 中测试一个 fragment 。我将 TestTragmentActivity 添加到 androidTest 以及 AndroidManifest.xml 文件。但是当
我有一个用于 UI 测试的 Espresso 测试套件,如下所示: @RunWith(AndroidJUnit4.class) public class SpecialUiTests { @R
我需要在每次测试前清空我的用户数据 // Kotlin code fun getActivity() = activityRule.getActivity() Before fun setUp() {
我在导入一些 Android UI 测试框架类时遇到了问题 - 我就是不知道出了什么问题! 这是我的课: @RunWith(AndroidJUnit4.class) @LargeTest public
我有一个接受深层链接的应用程序。 list .xml:
SingleLaunchActivityTestCase 的文档表示此类现已弃用,应替换为 ActivityScenarioRule或 ActivityTestRule .但是这是如何做到的呢? Si
我正在尝试在 Kotlin 中为我的 android 应用程序进行 UI 测试。由于使用 ActivityTestRule 的新系统,我无法使其工作:它编译正确,并且在运行时,我得到: java.la
我正在使用 Kotlin 开发 Android 应用程序。我正在将仪器测试添加到我的项目中。现在,我正在寻找一种方法来启用/禁用启动 Activity 的逻辑,因为它会使我的测试以意想不到的方式运行。
我怎么听ActivityTestRule's beforeActivityLaunched() android测试中的方法。 我的解决方法是创建自定义 ActivityTestRule 并在构造函数上
我尝试用 espresso 初始化我的 Activity 并模拟 onCreate 但没有找到一个好的解决方案,而不是将 Dagger 添加到我的项目中: @Rule public ActivityT
我是一名优秀的程序员,十分优秀!