We all know that testing is essential for programmers, so, to do the Android program, you have to learn to use JUnit, which is a bit more complicated than the JUnit test in Java, requires some configuration, and the next hungry, let's introduce how to use JUnit testing.
The first step:
1, new package: Package name is our "business method to test after registration plus +.test".
2, Build class: The class name is "test+ the class name to test."
3, Build Method: The method name is "test+ the method name to test."
Of course, this is not something that must be observed, and knowledge as an object-oriented development, we need such a specification.
Like what:
Step Two:
We need to configure the instrumentation instruction set with User-libray, where the content will not be written, and we can do so.
1, new Android test project.
After 2,next, we select the project to be tested in the list,
3, after determining, we in the generated test project in the Androidmanifest.xml file is not able to find we need two nodes of the writing, direct copy,
4, direct copy, instrumentation and User-libray node, to our test project, we need to note that the instrumentation to be under the Mainfest node, The User-libray is under the application node.
Then select the method you want to test, select Run as-->junit test, you can do the Android unit test.
Android Learning note-junit Unit test