Test related concepts
Whether there is source code
Black box test: test Tool
White box test: All the source code is very familiar with the test of the specific codes are programmed
Time
Unit Test (programmer)
Module testing
Integration Testing
System Testing
regression test ( bug fix)
Pressure
Monkey Test
Smoke test
Junit Unit Test
<!--The first step: Add the following code to the Androidmanifest.xml: under the <manifest> node -<InstrumentationAndroid:name= "Android.test.InstrumentationTestRunner"Android:targetpackage= "Package name of the application"></Instrumentation> <!--Step Two: Add the following code to the Androidmanifest.xml: under the <application> node -<uses-libraryAndroid:name= "Android.test.runner"/>
//Step Three: Java code Public classClass name TestextendsAndroidtestcase {//Unit Test Public voidTest Method Name ()throwsexception{//class object to testPersonservice PS =NewPersonservice (); //How to usePs.getfirstname (); } //Assertion Test Public voidTest Method Name ()throwsexception{//class object to testPersonservice PS =NewPersonservice (); //How to use intactual = Ps.add (1, 1); //Assertion TestAssert.assertequals (2, Actual); }}
Fourth Step
entering the test class Select Method Right-click: Run as--- android JUnit test
Logcat
Print logs in Android apps
General development using their own logcat printing can be controlled
/*** Log Tool class *@authorHuangyi*/ Public Final classMyLog {Private Final Static BooleanFLAG =true;//Test Public Static voidV (String tag,string msg) {if(FLAG) {LOG.V (tag, msg); } } Public Static voidd (String tag,string msg) {if(FLAG) {LOG.D (tag, msg); } } Public Static voidI (String tag,string msg) {if(FLAG) {LOG.I (tag, msg); } } Public Static voidW (String tag,string msg) {if(FLAG) {LOG.W (tag, msg); } } Public Static voide (String tag,string msg) {if(FLAG) {LOG.E (tag, msg); } }}
Android Test and Logcat