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