JUnit 4 与 ActivityInstrumentationTestCase2

JUnit 4 with ActivityInstrumentationTestCase2

我可以将 JUnit 4 与我的 class 扩展 ActivityInstrumentationTestCase2 一起使用吗?

我收到以下警告:

@Test inside class extending JUnit3 TestCase

我的class

public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
}

没有。 Android JUnit 是 JUnit3。测试是名称以 "test"

开头的方法

Is possible I use JUnit 4 with my class extend ActivityInstrumentationTestCase2?

是的,尽管您必须遵循 the documented recipe(请参阅页面下方的 ActivityInstrumentationTestCase2 说明)。

This sample project 包含遵循食谱的 ActivityInstrumentationTestCase2

I am getting the following warn

是的,那是 an IDEA warning that should be fixed in an upcoming release of Android Studio