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

  • SEARCH
  • Home
  • 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 7092327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:17:59+00:00 2026-05-28T08:17:59+00:00

I am unable to get any test cases that extend ServiceTestCase to run. There

  • 0

I am unable to get any test cases that extend ServiceTestCase to run. There are no errors they are just not executed.

Other test cases that extend AndroidTestCase do run.

The projects are set up as follows:

I have a Android Library that contains a service. It’s manifest file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.something.android"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="9"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application>
    <service android:name=".ExampleService" 
        android:exported="false"
    android:process=":example_service">
    </service>
</application>
</manifest>

The Android Library Project contains a test project in the folder test (created using the Android tools)

This contains a AndroidManfiest.xml as as follows

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.something.android.tests"
      android:versionCode="1"
      android:versionName="1.0">
<application>
    <uses-library android:name="android.test.runner" />
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
                 android:targetPackage="com.something.android.tests"
                 android:label="Tests for com.something.android"/>
</manifest>

I also have a build.properties in the test project which contains:

tested.project.dir=..
android.library.reference.1=..

I execute the tests by running ant clean run-tests.

What do I need to do to get the ServiceTestCase test to run?

Thanks in advance.

  • 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-28T08:17:59+00:00Added an answer on May 28, 2026 at 8:17 am

    Make sure that you provide a default constructor for the ServiceTestCase. The one Eclipse generates for you may not be appropriate. For example, in my case Eclipse generated for me:

    public class MyServiceTestCase extends ServiceTestCase<MyService> {
    
      public MyServiceTestCase(Class<MyService> serviceClass) {
        super(serviceClass);
      }
      ...
    }
    

    Android JUnit was not able to instantiate MyServiceTestCase, but it did not complain, and I only could see that no test cases where run.

    Thefore I replaced the constructor with the following, and it worked nicely:

    public class MyServiceTestCase extends ServiceTestCase<MyService> {
    
      public MyServiceTestCase() {
        super(MyService.class);
      }
      ...
    }
    

    Hope it works for you.

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

Sidebar

Related Questions

I get unable to open database file when executing rc = sqlite3_open(test.db, &db); ??
I renamed the class classBattle to Game and not I get Unable to load
I am getting this error with my new unit test: Unable to get type
I used the Apex Test Execution screen to run all the test cases in
I am unable to get growl notifications when i run $guard Do i need
I am unable to get the correct title for this, please change the title
I am unable to get a highcharts plugin to render a chart in a
I'm unable to get this jquery statement to work on page load but it
I'm unable to get the Central Maven repo index. I'm running Netbeans 7.0.1 and
I am unable to get a Javascript callback to work with gmaps4_rails when the

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.