How to run robotium tests in a specific order?

0
0

I have this robotium testproject which has one testclass. The test class contains all the test methods. Right now when I run the test class, the test methods are run in alphabetical order. Since I have some dependencies between the test methods(i know this is not the preferred practice) I want the test methods to run in a specific order. The reason I am having dependencies is that, it allows for less code to be written and makes the whole test class to run faster. Is there any way to run the test methods in a specific order?

  • You must to post comments
0
0

Create an Class which contains the order of testsuit. For eg:

package com.android.test; 
import junit.framework.TestSuite;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase2;
public class AllTests extends ActivityInstrumentationTestCase2<Activity> {
public AllTests(Class<Activity> activityClass) {
super(activityClass);
}
public static TestSuite suite() {
TestSuite t = new TestSuite();
t.addTestSuite(SplashScreenTest.class);
t.addTestSuite(MainLoginScreenTest.class);
t.addTestSuite(EmailSignUpScreenTest.class);
t.addTestSuite(EmailVerificationTest.class);
t.addTestSuite(EmailLoginScreenTest.class);
return t;
}
@Override
public void setUp() throws Exception {
}
@Override
public void tearDown() throws Exception {
}
}

By this way you can set the order of execution of your robotium
test suit. For complete tutorial check this link

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website