core tests coverage report 0%

by James Wang » Sat, 12 Dec 2009 16:48:53 GMT


Sponsored Links
 We ran core tests by the command "/development/testrunner/runtest.py  -
v --coverage core" and got coverage report successfully. But the
reports says all are 0%.
We ran apidemos and got coverage report which looks good.

Below is the console output for core tests:
-------------------------------------------------------------------------------------
No private recovery resources for TARGET_DEVICE dream-open
make:  `/usr/forCurl/android1.6r1' make: `files' 
make:  `/usr/forCurl/android1.6r1' Syncing to device...
about to run adb  sync
syncing /system...
0 files pushed. 377 files skipped.
syncing /data...
0 files pushed. 8 files skipped.

Waiting for device package manager...
about to run adb  wait-for-device
about to run adb  shell pm path android
about to run adb  shell cat init.rc | grep BOOTCLASSPATH | grep
emma.jar
Waiting for instrumentation to be present
about to run adb  shell pm list instrumentation | grep android.core/
android.test.InstrumentationTestRunner
Running in coverage mode, suppressing test output
am instrument -e class 'android.core.CoreTests' -e coverage 'true' -r -
w android.core/android.test.InstrumentationTestRunner
about to run adb  shell am instrument -e class
'android.core.CoreTests' -e coverage 'true' -r -w android.core/
android.test.InstrumentationTestRunner
Failure in android.webkit.CookieTest:testPath:
junit.framework.AssertionFailedError
        at android.webkit.CookieTest.testPath(CookieTest.java:191)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:164)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:151)
        at android.test.InstrumentationTestRunner.onStart
(InstrumentationTestRunner.java:425)
        at android.app.Instrumentation$InstrumentationThread.run
(Instrumentation.java:1520)


Tests run: 312, Failures: 1, Errors: 0
about to run adb  shell ls /data/data/android.core/files/coverage.ec
about to run adb  pull /data/data/android.core/files/coverage.ec /usr/
forCurl/android1.6r1/out/emma/framework/core/core.ec
EMMA: processing input files ...
EMMA: 2 file(s) read and merged in 503 ms
EMMA: writing [html] report to [/usr/forCurl/android1.6r1/out/emma/
framework/core/core.html] ...
Coverage report generated at /usr/forCurl/android1.6r1/out/emma/
framework/core/core.html
----------------------------------------------------------------

So I wonder why core tests's coverage report says 0% and how can I
make the report make sense.

Thanks in advance.

James

--



core tests coverage report 0%

by James Wang » Mon, 14 Dec 2009 09:03:30 GMT


 Hello, nobody had run core tests? Anybody can help me? Please!

--


Sponsored Links


Other Threads

1. Wait for Activity result

I'm trying to write a service that starts an activity and then does
something with data the activity receives from the user. I want to
wait for the activity to signal it has gotten the data from the user
but when I do any sort of waiting within the function that starts the
activity, the activity doesn't start. The following is just sample
code to help show what I want:

public void foo() {
    Thread t = new Thread() {
        public void run() {
            startActivity(intent);
            while(activityNotdone){}
        }
    }
    t.start();

    t.join();
    bar();
}

Doing this, the activity will never start. If I remove the while call,
the activity will start, but then bar runs before the activity has
gotten a response from the user. Any suggestions?

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

2. Problems with Activity Lifecycle, onRestoreInstanceState/onActivityResult

I work on an application where ActivityA starts ActivityB with
'startActivityForResult'. Overall, this seems to work fine, but there
are two things I do not understand:

1. After ActivityB executes finish(), the *first* method called in
ActivityA is onActivityResult with the correct result. But ActivityA
is still in stopped state and therefore does not have its current
state available. Shouldn't it be that the correct sequence is:
ActivityA.onStart ... ActivityA.onResume...
ActivityA.onActivityResult??? Btw: both activities have default launch
modes.

2. Before ActivityB gets executed, ActivityA.onSaveInstanceState is
executed (and others of course) so that it can make its state
persistent. However, after ActivityB is finished
ActivityA.onRestoreInstanceState and/or ActivityA.onCreate are not
called so that the saved state is lost and the activity has no chance
to restore its previous state. I can't see any reason why this is not
the case. Could anyone give me some light on this issue?

Thanks
Danny

The source code (reduced to the min) is as follows:

public class ActivityA extends Activity {
    public static final int ACTIVITYB = 0x20000001;
    public static final String INTENT_BACK_ARGUMENT =
"ActivityBToAArgument";
        public final static String INTENT_ARGUMENT = "ActivityAToBArgument";
    private Intent activityResult = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(new AbsoluteLayout(this));
    }

    protected void onStart() {
        super.onStart();

        handleActivityResults();
    }

    @Override
    protected void onRestart() {
        super.onRestart();

        setContentView(new AbsoluteLayout(this));
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        onSaveInstanceState(new Bundle());
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        bundle.putString("test", "testvalue");
    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        String val = savedInstanceState.getString("test");
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);

        menu.addSubMenu(0, 1, 0, "Activity B");

        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        super.onOptionsItemSelected(item);

        Intent openFileIntent = new Intent(this, ActivityB.class);
        openFileIntent.putExtra(INTENT_ARGUMENT, "Test");

        startActivityForResult(openFileIntent, ACTIVITYB);
        return true;
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (resultCode == RESULT_OK) {
                activityResult = data;
        }
    }

    private void handleActivityResults() {
        if (activityResult != null) {
                finishActivity(ACTIVITYB);

                String msg = activityResult.getExtras().getString
(INTENT_BACK_ARGUMENT);
                activityResult = null;
        }
    }
}

public class ActivityB extends Activity {
        private static final int MENU_TEST = 1;
        private String argument = "";

        @Override
        protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(new AbsoluteLayout(this));
        argument = getIntent().getExtras().getString
(ActivityA.INTENT_ARGUMENT);
        }

        @Override
        public boolean onKeyDown(int keyCode, KeyEvent event) {
                if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
                        setResult(RESULT_CANCELED, null);

                        finish();
                        return true;
                }

                return false;
        }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);

        menu.add(0, MENU_TEST, 0, argument);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
                Intent intent = new Intent();
                intent.putExtra(ActivityA.INTENT_BACK_ARGUMENT, "Seems ok");
                setResult(RESULT_OK, intent);

                finish();

        return true;
    }
}

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

3. ServerSocket.accept() not recognizing attempts to connect?

4. bluetooth on android

5. How to uninstall calculator package from emulator

6. Texting with Android Dialer?

7. Anyone interested in an Android Meet-up located in the Bay Area (CA)?