Reputation: 383
I write UI-tests on Espresso library for my custom components. I have separate classes, that extends ActivityInstrumentationTestCase2<MyActivityDebug>
, for every component, for example: CheckBoxTest
, EditTextTest
, SelectorText
... Now i run tests separately too. Help me, how can i run all tests one time from one place for all classes?
Upvotes: 2
Views: 1456
Reputation: 363677
You can define a Suite
/**
* Runs all unit tests.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({MyTest1.class , MyTest2.class, MyTest3.class})
public class InstrumentationTestSuite {}
Then in AndroidStudio you can run with gradle or setting a new configuration like:
Upvotes: 7
Reputation: 735
public class AllGuiTestsTablet extends TestCase {
public static TestSuite suite() {
TestSuite t = new TestSuite("YourAwesomeTests");
t.addTestSuite(CheckBoxTest.class);
t.addTestSuite(EditTextTest.class);
return t;
}
}
Just add all your tests to a testSuite and you should be fine
Upvotes: 2