Android Automation test: Robotium (c) Run test code in bulk

Source: Internet
Author: User

1. JUnit's Testsuite can centrally store test classes and run test cases in batches of test classes, with the following source code:
Package com.coolwi.km.user.testsuites;
Import Com.coolwi.km.user.testcase.MyCardRecord;
Import Com.coolwi.km.user.testcase.MyCardUserTestcase1;
Import Junit.framework.JUnit4TestAdapter;
Import Junit.framework.Test;
Import Junit.framework.TestSuite;
Import junit.sampling.*;
public class Testall {
public static Test Suite ()
{
TestSuite Suite = new TestSuite ("All Tests from Part1");//indicates that this iconic thing
Suite.addtestsuite (Mycardrecord.class);
Suite.addtestsuite (Mycardusertestcase1.class);
Suite.addtest (New Ttmmtest ("Testhelloworld"));//You can add a single test method here
return suite;
}
}
For a chestnut: You can create a new testsuites to store all the Testsuit, create a new loginsuit under this package, and then write login_1, Login_2, login_3 to run the test case for login
2. Choose to run Testall with Android Junit test to run all the selected test cases in bulk
3. Report produced in junit format
A, import (a) in the jar package
b, create a new runner under the runner package named Commonrunner, let the runner inherit Junitreporttestrunner, declare the androidmanifest.xml in runner
<instrumentation
Android:name= "Com.zutubi.android.junitreport.JUnitReportTestRunner"
Android:name= "Com.coolwi.km.user.runner.CommonRunner"
Android:targetpackage= "Com.coolwi.km.user"/>
C, update the first step of the class is TestAll1, inherit Commonrunner, run TestAll1
4. Export Test Cases
ADB pull/data/data/com.xxx.xxx/files/junit-report.xml
A, adb shell into the phone, and CD (make sure the phone is rooted)
b, Su switch to root identity
C, use rm-f junit-report.xml to ensure that the file is not in the phone, and then run the script
PS: You may not see the report after running the script because the folder does not have permission to write, you need to chmod the folder, and then run the script
Cd/data
Chmod-r 777/data
Cd/data/data
Chmod-r 777/data/data

Android Automation test: Robotium (c) Run test code in bulk

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.