Android UnitTest FrameWork

Source: Internet
Author: User

  1. 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
  2. The JUnit extensions for Android provides component-based test classes that help to create mock objects that control the life cycle of COMPONETN
  3. Android testing Apid supports JUNIT3 's code style, not JUNIT4
  4. Android Instrumentation provides a way to invoke the life cycle method of Android component, such as activity oncreate,onresume, etc.
  5. 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




  6. 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

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.