2015-11-24 79 views
1

我在Espresso库上为我的自定义组件编写UI测试。我有单独的类,它扩展了ActivityInstrumentationTestCase2<MyActivityDebug>,对于每个组件,例如:CheckBoxTest,EditTextTest,SelectorText ...现在我也单独运行测试。帮助我,我如何从一个地方为所有课程运行所有测试?从一个普通类运行所有UI测试

回答

2

可以定义Suite

/** 
* Runs all unit tests. 
*/ 
@RunWith(Suite.class) 
@Suite.SuiteClasses({MyTest1.class , MyTest2.class, MyTest3.class}) 
public class InstrumentationTestSuite {} 

然后在AndroidStudio你可以gradle这个或设置像一个新的配置下运行:

enter image description here

1
public class AllGuiTestsTablet extends TestCase { 

public static TestSuite suite() { 
TestSuite t = new TestSuite("YourAwesomeTests"); 

t.addTestSuite(CheckBoxTest.class); 
t.addTestSuite(EditTextTest.class); 
return t; 
    } 
} 

只是所有的测试添加到测试套件,你应该罚款

相关问题