Since I was in touch with Eclipse earlier, let me start with the JUnit configuration in Eclipse. First we build an empty project and add a test class Junittest.java
Second step: Import the JUnit library, project name---> Right-->build Path--->add Libraries ...
Step Three: Click Add Libraries ... After selecting JUnit, select default JUnit 4. Complete
Fourth step: Junittest.java the test class, and right-click on a new JUnit test case
Configure the relevant parameters, as shown in
Select the method you want to test, click Finish
Classes to be tested and corresponding test classes
Fifth step: Test. Method Name--right---run as-->juint test to debug
Choose Eclipse or Eclipse ADT with JUnit for testing
Debug results:
These are the JUnit unit tests in Eclipse, where unit tests are integrated by default and do not require any configuration, just, under the Androidtest folder, build a test class to inherit
Instrumentationtestcase class is good It's good to put the required method into the test.
First step: Build a Test class Testclass.java and inherit instrumentationtestcase
The second step: Add the test method, the format of the test method should be testxxx, Right-click the method name run can be tested
Run results
The meaning of unit testing: I'm not good at this, but at least I don't feel like running the whole project in order to see the results of a certain number of parameters in a method, and then it is more effective to know the implementation of their ideas. Thank you for your appreciation and if you have any questions, please correct them if you have any questions.
Reprint please indicate source: http://blog.csdn.net/nmyangmo/article/details/51179106