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


Other Threads

1. OutOfMemoryError when changing screen orientation

Hi,

I get an OutOfMemoryError every time i change the screen orientation
and I am having a hard time finding the mistake...

The Activitie's view consists of an ImageView, two Buttons and a
Spinner. I don't have static variables and can't imagine where i could
leak a context.

Most of the times, the exception is thrown at setContentView
(R.layout.upload);
sometimes it goes fine until imgUpload.setImageURI(imageURI);

The images i am displaying are form the G1's camera, so about 500kb
and 2048x1536pixels

Here is some code:
-------------------------------------------------------------------------------------
        private ImageView imgUpload;
        private Spinner spnCollections;
        private Button btnEditMetadata;
        private Button btnUpload;
        private Uri imageURI;

        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.upload);

                // Get View References
                imgUpload = (ImageView) findViewById(R.id.imgUpload);
                spnCollections = (Spinner)findViewById(R.id.spnCollections);
                btnEditMetadata = (Button) findViewById(R.id.btnEditMetadata);
                btnUpload = (Button)findViewById(R.id.btnUpload);

                // Get Image from ACTION_SEND Intent
                Intent intent = getIntent();
                if (intent.getAction() != null && intent.getAction().equals
(Intent.ACTION_SEND)) {
                        Bundle extras = intent.getExtras();
                        imageURI = 
(Uri)extras.getParcelable(Intent.EXTRA_STREAM);
                        imgUpload.setImageURI(imageURI);
                }
...
-------------------------------------------------------------------------------------

--~--~---------~--~----~------------~-------~--~----~

2. what do MACRO "LOCAL_SDK_VERSION " do?

Hi All,
When I compile one example , I met with the following errors:
development/samples/HelloActivity/src/com/example/android/
helloactivity/HelloActivity.java:19: cannot find symbol
symbol  : class ActivityManagerNative
location: package android.app
import android.app.ActivityManagerNative;
                   ^
development/samples/HelloActivity/src/com/example/android/
helloactivity/HelloActivity.java:25: cannot find symbol
symbol  : class ServiceManager
location: package android.os
import android.os.ServiceManager;
                  ^
development/samples/HelloActivity/src/com/example/android/
helloactivity/HelloActivity.java:39: package
com.android.internal.telephony does not exist
import com.android.internal.telephony.ITelephony;
                                      ^
3 errors
make: *** [out/target/common/obj/APPS/HelloActivity_intermediates/
classes-full-debug.jar] Error 41


Finally I find if I comment out LOCAL_SDK_VERSION := current in the mk
file, then the error disappear,

Can anyone tell me why?

Thanks

Max
--~--~---------~--~----~------------~-------~--~----~

3. what's "/sys/class/net/ppp0/operstate"? where can i find the source code about it?

4. KeyEvent.KEYCODE_ENDCALL doesn't work

5. How to show two or more fields to list(Notepad Tutorial)?

6. sales on android - how is that going??

7. " Touch events from my PC to device using adb shell "