Android Test and Logcat

Source: Internet
Author: User

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

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.