Werder
Werder

Reputation: 383

Run all Ui Tests from one general class

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

Answers (2)

Gabriele Mariotti
Gabriele Mariotti

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:

enter image description here

Upvotes: 7

PKAP
PKAP

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

Related Questions