Android Espresso 软件包 'android.support.test.espresso.intent' 的依赖关系是什么?



我遇到了一个有趣的包,其中包含了用于测试Intent发送的Intents类,以及IntentMatchers类,如Intents类页面上列出的代码片段所示:

Intent resultData = new Intent();
String phoneNumber = "123-345-6789";
resultData.putExtra("phone", phoneNumber);
ActivityResult result = new ActivityResult(Activity.RESULT_OK, resultData);
// Set up result stubbing when an intent sent to "contacts" is seen.
intending(toPackage("com.android.contacts")).respondWith(result));

但是当我尝试的时候,Android Studio抱怨不知道这些类。我检查了android-test-kit网站上列出的Espresso罐装咖啡(Espresso -core和Espresso -contrib),确实在这些罐装咖啡中找不到任何android.support.test.espresso.intent包。我是否缺少任何依赖关系?

您还需要

androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2'

最新更新