austgl / robotium

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

I have still issues when try run Test Project #153

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
package com.cieaura.test;

import com.jayway.android.robotium.solo.Solo;

import android.test.ActivityInstrumentationTestCase2;
import com.cieaura.R;
import com.cieaura.virtualoffice.activity.VOLogin;
import android.widget.EditText;
import android.widget.LinearLayout;
//import android.widget.TextView;

public class TestLogin extends ActivityInstrumentationTestCase2<VOLogin> {
    private Solo solo;
    private LinearLayout llTopbar;
    public TestLogin() {
        super("com.cieaura.virtualoffice.activity",VOLogin.class);
    }
@Override
    protected void setUp() throws Exception {
        super.setUp();
        solo = new Solo(getInstrumentation(),getActivity());
        //System.out.println("There are" + this.countTestCases() + "test cases");
    }

public void testNullValue()
{
    try {
           Object o = null;
           o.toString();
           fail("Expected NullPointerException to be thrown");
        } catch (NullPointerException e) {
           assertTrue(true);
        }

}

public void testAdd()throws Exception
{
    llTopbar=(LinearLayout)getActivity().findViewById(R.id.layout_top_bar);
    solo.assertCurrentActivity(getName(), VOLogin.class);
    super.launchActivity(getName(),VOLogin.class,null);
    String user123="abc";
    String pass123="1234";

    EditText User=(EditText)solo.getView(R.id.et_vo_login_username);
    solo.enterText(User, user123);
    EditText Pass=(EditText)solo.getView(R.id.et_vo_login_password);
    solo.enterText(Pass, pass123);

}

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

        super.tearDown();

}
}

What is the expected output? What do you see instead?
Test failed to run to completion. Reason: 'Instrumentation run failed due to 
'java.lang.NullPointerException''. Check device logcat for details.

And issues in Logcat:

09-07 08:58:18.396: ERROR/AndroidRuntime(357): FATAL EXCEPTION: main
09-07 08:58:18.396: ERROR/AndroidRuntime(357): java.lang.RuntimeException: 
Unable to start activity 
ComponentInfo{com.cieaura/com.cieaura.virtualoffice.activity.VOLogin}: 
java.lang.NullPointerException
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
android.os.Looper.loop(Looper.java:123)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
android.app.ActivityThread.main(ActivityThread.java:4627)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
java.lang.reflect.Method.invokeNative(Native Method)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
java.lang.reflect.Method.invoke(Method.java:521)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
dalvik.system.NativeStart.main(Native Method)
09-07 08:58:18.396: ERROR/AndroidRuntime(357): Caused by: 
java.lang.NullPointerException
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
com.cieaura.virtualoffice.activity.VOLogin.onCreate(VOLogin.java:52)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-07 08:58:18.396: ERROR/AndroidRuntime(357):     ... 11 more
09-07 08:58:18.426: WARN/ActivityManager(67): Error in app com.cieaura running 
instrumentation 
ComponentInfo{com.cieaura.test/android.test.InstrumentationTestRunner}:
09-07 08:58:18.426: WARN/ActivityManager(67):   java.lang.NullPointerException
09-07 08:58:18.426: WARN/ActivityManager(67):   java.lang.NullPointerException: 
Unable to start activity 
ComponentInfo{com.cieaura/com.cieaura.virtualoffice.activity.VOLogin}: 
java.lang.NullPointerException
09-07 08:58:18.455: INFO/ActivityManager(67): Force stopping package 
com.cieaura uid=10038
09-07 08:58:18.486: INFO/Process(67): Sending signal. PID: 357 SIG: 9
09-07 08:58:18.585: DEBUG/AndroidRuntime(351): Shutting down VM
09-07 08:58:18.596: DEBUG/jdwp(351): Got wake-up signal, bailing out of select
09-07 08:58:18.596: DEBUG/dalvikvm(351): Debugger has detached; object registry 
had 1 entries
09-07 08:58:18.646: INFO/UsageStats(67): Unexpected resume of 
com.android.launcher while already resumed in com.cieaura
09-07 08:58:18.655: INFO/AndroidRuntime(351): NOTE: attach of thread 'Binder 
Thread #3' failed
09-07 08:58:18.665: WARN/InputManagerService(67): Window already focused, 
ignoring focus gain of: 
com.android.internal.view.IInputMethodClient$Stub$Proxy@44f9e5b0
09-07 08:59:23.166: DEBUG/StatusBar(67): DISABLE_EXPAND: yes
09-07 08:59:28.445: DEBUG/dalvikvm(131): GC_EXPLICIT freed 1193 objects / 86384 
bytes in 160ms
09-07 08:59:33.455: DEBUG/dalvikvm(172): GC_EXPLICIT freed 1043 objects / 48184 
bytes in 159ms
09-07 09:00:55.486: DEBUG/SntpClient(67): request time failed: 
java.net.SocketException: Address family not supported by protocol

What version of the product are you using? On what operating system?
I use Robotium 2.4 and Android 2.2

Please provide any additional information below.

Original issue reported on code.google.com by tranhong...@gmail.com on 7 Sep 2011 at 2:03

GoogleCodeExporter commented 9 years ago
This is not a robotium defect. 

Original comment by renasr...@gmail.com on 7 Sep 2011 at 9:32

GoogleCodeExporter commented 9 years ago
Thanks you!
I will try run test project again.

Original comment by tranhong...@gmail.com on 12 Sep 2011 at 2:31

GoogleCodeExporter commented 9 years ago
Error : Test failed to run to completion. Reason: 'Instrumentation run failed 
due to 'java.lang.IllegalArgumentException''. Check device logcat for details

 I had got an error which is mentioned above. However my script is running properly. Please guide me about how to overcome the error.

Original comment by mgmanika...@gmail.com on 14 Jun 2013 at 8:50