Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4563318
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:20:28+00:00 2026-05-21T18:20:28+00:00

I have written my content provider supposed to wrap access to 2 tables in

  • 0

I have written my content provider supposed to wrap access to 2 tables in a SqlLite database. Now I’d like to write some test cases for it but I have never done it. After reading the section on the developer guide, I must say that I did not manage to get anything tested.

Below is my code so far. This is the only class in the test project that corresponds to my main project. When I execute it in Eclipse, the emulator starts correctly, the packages get installed but it does not run the test:

Test run failed: Test run incomplete.
Expected 1 tests, received 0

Here is the test class:

public class ArticleProviderTest extends ProviderTestCase2<ArticleProvider> {

    static final Uri[] validUris = new Uri[] { Articles.CONTENT_URI, 
       Pictures.CONTENT_URI,
       Pictures.getContentUriForArticleId(1) };

    public ArticleProviderTest(Class<ArticleProvider> providerClass, String providerAuthority) {
        super(providerClass, providerAuthority);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }

    public void testQuery() {
        ContentProvider provider = getProvider();    
        for (Uri uri : validUris) {
            Cursor cursor = provider.query(uri, null, null, null, null);
            assertNotNull(cursor);
        }    
    }
}

And the manifest file, if it helps:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="fr.marvinlabs.xxxx"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="7" />
    <instrumentation android:targetPackage="fr.marvinlabs.xxxx" android:name="android.test.InstrumentationTestRunner" />
    <application android:icon="@drawable/icon" android:label="@string/app_name">
    <uses-library android:name="android.test.runner" />
    </application>
</manifest>

When I launch in debug configuration, breakpoints in the constructor and in the setUp don’t get triggered. ?!

I also did not find much info on the net. Could anybody help me get some understanding on how the testing should be setup (basically create a test database file, fill it with some data, query it, …)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T18:20:29+00:00Added an answer on May 21, 2026 at 6:20 pm

    Ok, got it. Mistake was that I was not providing the default constructor for the test class. I had overridden the wrong constructor:

    public ArticleProviderTest(Class<ArticleProvider> providerClass, String providerAuthority) {
        super(providerClass, providerAuthority);
    }
    

    is now

    public ArticleProviderTest() {
        super(ArticleProvider.class, "com.blah.azerty");
    }
    

    2am is the time when you cannot read the docs entirely well, afternoon is better 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a content provider with one database helper and have started to build
I have written a Custom Content Provider on top of a SQLite Database. The
This is the script I have written for gzipping content on my site, which
I have written simple code to get content from xml file to php. $xml
I have to write an XML file using java.The contents should be written from
I have written a function that sorts a big scale of data. To test
I have a content provider that is custom to my set of Android applications,
I have written a html page where i want a header,content,footer. All these three
I have written a small rails app to serve up content to another site
I'm refactoring some code and I have written a method that modifies a Dictionary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.