I need to collect some data on my current app in order to analyse performance speed by checking the average ellapsed time during Activity start up. I would like to run a test battery where the activity is started 10, 100, 1000 and 5000 times. For each test, it should remain open for at least 10 seconds (time needed to collect all data that happens asynchronously). What I want is exactly this behaviour without having to write these many methods:
@RunWith(AndroidJUnit4.class)
@LargeTest
public class TestStreamLoadingPerformance {
private static final long TIME_OUT = 2;
private static final long WAITING_TIME = 10000;
@Rule
public ActivityTestRule mActivityRule = new ActivityTestRule(HomepageActivity.class);
private ElapsedTimeIdlingResource mIdleRes = new ElapsedTimeIdlingResource(WAITING_TIME);
@Before
public void setUp() {
IdlingPolicies.setMasterPolicyTimeout(TIME_OUT, TimeUnit.HOURS);
IdlingPolicies.setIdlingResourceTimeout(TIME_OUT, TimeUnit.HOURS);
Espresso.registerIdlingResources(mIdleRes);
}
@After
public void tearDown() {
Espresso.unregisterIdlingResources(mIdleRes);
}
@Test
public void test01() {
}
@Test
public void test02() {
}
@Test
public void test03() {
}
@Test
public void test04() {
}
@Test
public void test05() {
}
@Test
public void test06() {
}
@Test
public void test07() {
}
@Test
public void test08() {
}
@Test
public void test09() {
}
}