Android Test Tutorial (7): Test content Provider

Source: Internet
Author: User
Tags pack

Content Provider provides a unified interface for different applications to access data, and this article describes the knowledge that is used to test content Provider in the Android test pack.

The basic class for testing the content Provider in the Android test pack is PROVIDERTESTCASE2, allowing you to test the content Provider in an isolated environment. and provides some mock classes such as Isolatedcontext, mockcontentresover to assist the test.

As with other tests, the content provider test is done through Instrumentationtestrunner.

The general way to compile test code is by deriving ProviderTestCase2 (a subclass of Androidtestcase), so you can test the content Provider using the methods associated with JUnit and the Android platform.

You can see the following example to learn how to test the content Provider.

See a full set of tutorials: http://www.bianceng.cn/OS/extra/201301/35252.htm

Related Article

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.