Problem in running test case

by Siddharth Choudhary » Wed, 20 Oct 2010 17:23:48 GMT


Sponsored Links
 Hello ,

I am working on android automation ,and i am new to this field , i
went through the test example available at developer site and i am
getting

11-05 14:43:14.509: WARN/TestGrouping(1485): Invalid Package: '' could
not be found or has no tests

as  error on running  this code .


package com.android.myservice.test;

import com.android.myservice.MockActivity;

import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;

public class TestCaseOne extends
ActivityInstrumentationTestCase2<MockActivity> {

        public TestCaseOne(String pkg, Class<MockActivity> activityClass) {
                super("com.android.myservice.test", MockActivity.class);
        }

        public void test001case()
        {
                Log.e("", "test case 001");
        }
}


But when i extend this class with InstrumentationTestCase then this
code work's fine please let me know what mistake am i  doing in using
ActivityInstrumenationTestCase2.

--



Problem in running test case

by A. Elk » Fri, 22 Oct 2010 00:22:55 GMT


 This class looks OK to me, with one possible exception that I'll
mention at the end.

You didn't post the manifest file for this test package. The problem
might be there.

You said "when I extend this class with InstrumentationTestCase..."
Can you post exactly what you mean? Which class is "this" class? You
should not have to extend TestCaseOne with *both*
ActivityInstrumentationTestCase2 *and* InstrumentationTestCase, since
ActivityInstrumentationTestCase2 itself extends
InstrumentationTestCase. So please clarify what you mean.

One off-the-wall thought: Your first test is named test001case(). I
know that JUnit 3 figures out which methods in a test case are tests
by looking for a prefix of "test". If it strips off the "test", the
method name that remains is 001case, and I wonder if that causes
hiccups somewhere. I try to name all my test methods with a
description of the method or operation they're testing. As an example,
to test an Activity's onPause() method I'd name the test
"testOnPause()". Try using a non-numeric name and see what happens.

Joe




--


Sponsored Links