Open GoogleCodeExporter opened 9 years ago
The new ActivityTestRule works properly with JUnit4.
Full working example:
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
@RunWith(AndroidJUnit4.class)
public class VideoCaptureActivityTest {
@Rule
public ActivityTestRule<VideoCaptureActivity> mActivityRule = new ActivityTestRule<>(VideoCaptureActivity.class);
@Test
public void checkPreconditions() {
assertThat(mActivityRule.getActivity(), notNullValue());
}
}
Still I feel the documentation
(https://code.google.com/p/android-test-kit/wiki/AndroidJUnitRunnerUserGuide)
should be updated as this refers to a non working example.
Original comment by jeroen.m...@gmail.com
on 1 Sep 2015 at 2:41
Original comment by slinz...@google.com
on 15 Sep 2015 at 10:58
Original issue reported on code.google.com by
jeroen.m...@gmail.com
on 1 Sep 2015 at 12:45