The first step: Write a class to inherit Androidtestcase
Public class extends Androidtestcase
and write a test method,
Note that the method to be tested must be public void, and the method cannot receive any parameter information
1 Public void Testinsert () {2 }
Step Two: Add the instruction set used in the manifest file, and the class library to use
<!-- specifying the target application to be tested by the package life - < Instrumentation Android:name = "Android.test.InstrumentationTestRunner" android:targetpackage= "Com.itheima.studentsystem"></ Instrumentation >
You also need to add uses-library under the application element.
<!-- use to this class library - < android:name= "Android.test.runner"/>
Step three: Run the test method (right-click Run as Android Junit Test)
public void Testadd () {}
Steps for writing test code in Android engineering