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