Android Learning notes (7) Android Program debugging Learning

Source: Internet
Author: User
Tags log log

14th Lesson for Joshui teacher

One, log log output

log.v (tag,message); Verbose mode, print the most detailed log
LOG.D (Tag,message); Debug-level logs
LOG.I (Tag,message); Log at info level
LOG.W (Tag,message); Warn-level logs
LOG.E (Tag,message); Log at error level
tag is used to mark the source of the log message with represented. Message is the contents of this log.


Two, Unit test
Step1: Add the following configuration information in Androidmanifest.xml:
<!--<application> Medium:--><uses-library android:name= "Android.test.runner"/><!--</ After application>:--><instrumentation<instrumentation android:name= " Android.test.InstrumentationTestRunner "              android:targetpackage=" szy.android.activity "android:label=" testing />  
step2 Writing Unit test code
a better approach is to create a new source Floderz in the project to write the unit file to be tested and add it to the Androidtestcase:
public class Persondaotest extends Androidtestcase {private static final String TAG = "Persondaotest";p ublic void Testadd ( )  //method {LOG.I (TAG, "test") to be tested;} public void Testdelete ()//method {fail ("not yet implemented") to be tested;}}
check a method in the tested class when testing right-runas->android junit test
The junit window has a green bar to indicate that the test passes. Red is a problem.


Three, commissioning

Debug is relatively simple, you get started groping.


Report:

Unit Tests for Android apps

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Learning Note (7) Android program debugging learning

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.