sangmingming / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

Process crashed when simple calculator test is invoked #122

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i started using robotium recently and i am facing problems running it on simple 
applications like browser and calculator

i am proceeding according to the instructions provided in 
http://code.google.com/p/robotium/wiki/RobotiumForAPKFiles

the code i used for calculatortest app is pasted below..

package com.android.calculator2.test;

import android.app.Activity;
import android.test.ActivityInstrumentationTestCase2;
import com.jayway.android.robotium.solo.Solo;

public class CalculatorTest extends ActivityInstrumentationTestCase2{          
    private static final String TARGET_PACKAGE_ID = "com.android.calculator2";         
    private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.android.calculator2/.Calculator";          
    private static Class<?> launcherActivityClass;         

    static{                 
        try {  
            Activity act = new Activity();
            launcherActivityClass = Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);                 
            } catch (ClassNotFoundException e) {                         
                throw new RuntimeException(e);                 
            }         
    }                  
//  @SuppressWarnings("unchecked")         
    public CalculatorTest() throws ClassNotFoundException {                 
        super(TARGET_PACKAGE_ID, launcherActivityClass);         
    }

    private Solo solo;                  
    @Override         
    protected void setUp() throws Exception {                 
        solo = new Solo(getInstrumentation());         
        }          
        public void testCanOpenSettings(){
            solo.getActivityMonitor();
            getActivity();

            solo.sendKey(Solo.DOWN);
            solo.goBack();
    }   

    @Override    
    public void tearDown() throws Exception {          
        try {                 
            solo.finalize();         
            } catch (Throwable e) {                  
                e.printStackTrace();         
                }         
            getActivity().finish();         
            super.tearDown();    
    }   
}

What is the expected output? What do you see instead?
the output in eclipse is 
[2011-06-24 15:26:15 - CalTest] ------------------------------
[2011-06-24 15:26:15 - CalTest] Android Launch!
[2011-06-24 15:26:15 - CalTest] adb is running normally.
[2011-06-24 15:26:15 - CalTest] Performing 
android.test.InstrumentationTestRunner JUnit launch
[2011-06-24 15:26:15 - CalTest] Automatic Target Mode: using device 
'MSM7630_SURF'
[2011-06-24 15:26:15 - CalTest] Uploading CalTest.apk onto device 'MSM7630_SURF'
[2011-06-24 15:26:15 - CalTest] Installing CalTest.apk...
[2011-06-24 15:26:20 - CalTest] Success!
[2011-06-24 15:26:20 - CalTest] Launching instrumentation 
android.test.InstrumentationTestRunner on device MSM7630_SURF
[2011-06-24 15:26:20 - CalTest] Collecting test information
[2011-06-24 15:26:21 - CalTest] Test run failed: Process crashed.

What version of the product are you using? On what operating system?
i am using robotium-solo-2.3.jar as external library
eclipse latest version and testing on android 2.3.4

Please provide any additional information below.
the same error resulted when i tried the procedure with browser app as well ..
i can post the logs if required

Original issue reported on code.google.com by xperiaofdinesh@gmail.com on 24 Jun 2011 at 10:03

GoogleCodeExporter commented 9 years ago
You have to change launcher activity full class name to:

com.android.calculator2.Calculator

Original comment by renasr...@gmail.com on 29 Jun 2011 at 10:15