- Android test suites based on JUnit, you can test the class without using the Android API directly using JUnit, or you can use the Android JUnit extensions to test Android component
- The JUnit extensions for Android provides component-based test classes that help to create mock objects that control the life cycle of COMPONETN
- Android testing Apid supports JUNIT3 's code style, not JUNIT4
- Android Instrumentation provides a way to invoke the life cycle method of Android component, such as activity oncreate,onresume, etc.
- The first thing to add Junit.jar to the application Lib path, and then to test the class on the operation, will generate the test class pieceimagetest, note that pieceimagetest does not inherit any class, the execution of the test method will get the following error message:
Junit.framework.AssertionFailedError:No tests found in
You need to have pieceimagetest inherit testcase, you can run the test case, and the test method name does not start with test
- JUNIT4 itself does not require the test class to inherit from the TestCase, but in Android studio does not inherit testcase will throw no tests found in error, in addition Junit4.11 does not contain hamcrest package, Hamcrest for enhanced JUnit testing capabilities
Android UnitTest FrameWork