[英]Android Automation of Regression Testing using Robotium
I have generated a robotium test case and successfully tested the same on real device. 我已经生成了机械手测试用例,并在真实设备上成功测试了该用例。 Now, i like to know how can i run the same test case (Class that extends ActivityInstrumentationTestCase2) repeatedly. 现在,我想知道如何重复运行相同的测试用例(扩展ActivityInstrumentationTestCase2的类)。
Please let me know if any code sample for doing the same. 请让我知道是否有任何用于执行相同操作的代码示例。
Thanks 谢谢
I achieved this 2 ways .. 我实现了这两种方法..
Method 1 - Same Test case can be called many times from a class that extends InstrumentationTestRunner. 方法1-可以从扩展InstrumentationTestRunner的类中多次调用同一测试用例。
import junit.framework.TestSuite;
import android.test.InstrumentationTestRunner;
import android.test.InstrumentationTestSuite;
public class MediaFrameworkTestRunner extends InstrumentationTestRunner {
@Override
public TestSuite getAllTests() {
InstrumentationTestSuite suite = new InstrumentationTestSuite(this);
suite.addTestSuite(MainActivityTest.class);
suite.addTestSuite(MainActivityTest.class);
return suite;
}
@Override
public ClassLoader getLoader() {
return MediaFrameworkTestRunner.class.getClassLoader();
}
}
Method 2 - Add a loop statement inside the testRecorded() method 方法2-在testRecorded()方法内添加循环语句
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.