Android SDK 1.5 has been included in JUnit, used once, last night re-use when there is a bit of a problem, or decided to write a more detailed article for everyone and their future use, writing is also very convenient, JUnit under Android is an extension to JUnit under Java, which is basically similar to
about JUnit
JUnit is an open-source Java Unit Testing framework. In 1997, the development was completed by Erich Gamma and Kent Beck. The two bulls, Erich Gamma, is one of GOF Gang of four; Kent Beck is the founder of XP (Extreme programming) Extreme Programming (not Window XP). As the saying goes, "perfectly formed." "JUnit is designed to be very small, but it is very powerful. JUnit is very common in TDD (test driven development) test-driven development, and JUnit is a well-designed test framework that has been extended by Android to make it easier to use.
Some features of JUnit:
1) provides an API that allows you to write a reusable unit test case with a clear test result
2) provides three ways to display your test results, and can also extend
3) provides functionality for unit test cases to run in batches
4) ultra-lightweight and easy to use, no commercial deception and useless wizards
5) The whole frame is well designed and easy to expand
Android Junit Demo
First googlejunit the project, and then create a new test case:
public class Bookcase extends Androidtestcase {public void test () {LOG.I ("bookcase", "Test");}}
Androidtestcase in fact itself is inherited from the testcase, if this operation is not able to run, need to androidmanifest.xml configuration:
After configuring this, you also need to application configure Uses-library:
The final step is to test the right-click Method Run As=>android Junit test, the result is as follows:
Accidentally Monday, you yards farmers (including me) Monday and the keyboard life, refueling ~
JUnit Test under Android