Niedzielski has uploaded a new change for review. https://gerrit.wikimedia.org/r/251278
Change subject: Hygiene: move PageLoadPerformanceTests to JUnit 4 ...................................................................... Hygiene: move PageLoadPerformanceTests to JUnit 4 * Replace ActivityInstrumentationTestCase2 with @ActivityTestRule and JUnit 4. * Replace assertEquals calls with assertThat. Change-Id: Ice8ffa34a9e37dd80094ca0aa47522fda5adc27a --- M app/src/androidTest/java/org/wikipedia/test/perf/PageLoadPerformanceTests.java 1 file changed, 15 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/78/251278/1 diff --git a/app/src/androidTest/java/org/wikipedia/test/perf/PageLoadPerformanceTests.java b/app/src/androidTest/java/org/wikipedia/test/perf/PageLoadPerformanceTests.java index b68bdc8..480198f 100644 --- a/app/src/androidTest/java/org/wikipedia/test/perf/PageLoadPerformanceTests.java +++ b/app/src/androidTest/java/org/wikipedia/test/perf/PageLoadPerformanceTests.java @@ -1,14 +1,18 @@ package org.wikipedia.test.perf; +import org.junit.Rule; +import org.junit.Test; import org.wikipedia.page.PageActivity; import org.wikipedia.page.PageFragment; import org.wikipedia.page.PageLoadCallbacks; import org.wikipedia.page.PageLoadTests; import org.wikipedia.testlib.TestLatch; -import android.test.ActivityInstrumentationTestCase2; +import android.support.annotation.NonNull; +import android.support.test.rule.ActivityTestRule; import android.test.suitebuilder.annotation.LargeTest; +import static android.support.test.InstrumentationRegistry.getInstrumentation; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsNull.notNullValue; @@ -16,22 +20,14 @@ * Test performance of page loading. Update the NUM_RUNS for better statistical significance. */ @LargeTest -public class PageLoadPerformanceTests extends ActivityInstrumentationTestCase2<PageActivity> { +public class PageLoadPerformanceTests { + @Rule @NonNull + public final ActivityTestRule<PageActivity> activityRule = new ActivityTestRule<>(PageActivity.class); + private static final int NUM_RUNS = 1; //50; private final MeasurementController measurement = new MeasurementController(); - public PageLoadPerformanceTests() { - super(PageActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - - // Launch Activity. - getActivity(); - } - + @Test public void testLoadPages() throws Throwable { loadPageMultipleTimes("Test_page_for_app_testing/Section1"); loadPageMultipleTimes("A_long_page"); @@ -48,6 +44,7 @@ private void loadPageUi(final String title) throws Throwable { final TestLatch latch = new TestLatch(); + getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { @@ -74,4 +71,8 @@ private PageFragment getFragment() { return (PageFragment) getActivity().getTopFragment(); } + + private PageActivity getActivity() { + return activityRule.getActivity(); + } } -- To view, visit https://gerrit.wikimedia.org/r/251278 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice8ffa34a9e37dd80094ca0aa47522fda5adc27a Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits