austgl / robotium

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

Unable to call activity from Instrumentation test runner #177

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.building a test app to call UI of main app
2.I am followed the steps provided in sample for robotium
3.it is calling only the first screen but as main app has timer on first screen 
it is not moving to login screen

What is the expected output? What do you see instead?
it should move to login screen and shld able  to click editable fields

What version of the product are you using? On what operating system?
robotium 2.5,android 2.3,windows

Please provide any additional information below.
please find my test code :

package com.fusionone.android.sync.baclient.test;

import java.io.IOException;
import java.util.ArrayList;

import android.app.Activity;
import android.content.ContentResolver;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.Smoke;
import android.widget.TextView;

import com.fusionone.android.sync.baclient.test.helper.Constants;
import com.fusionone.android.sync.baclient.test.helper.HelperActivity;
import com.fusionone.android.sync.baclient.test.xml.ContactXMLProcessor;

//import com.fusionone.android.sync.baclient.BAMainLauncherActivity;
//import com.fusionone.android.contactsgenerator.view.ContactGenerationActivity;
import com.jayway.android.robotium.solo.Solo;

import com.fusionone.android.sync.baclient.test.db.DBUtility;

@SuppressWarnings("unchecked")
public class BAHTSTestCaseTesting extends ActivityInstrumentationTestCase2{

    private static final String MDN = "9986345955";
    private static final String DEVICEID = "145585454557";
    private static final String SYNC_RUL = "http://pegqaauto-sync01.fusionone.com/syncml";
    private static final String AM_URL = "http://pegqaauto-sync01.fusionone.com/account";
    private static final boolean WIFI = true;

    private Solo solo;
    private Activity activity;
    HelperActivity helpClass;
    ContactXMLProcessor contactXMLReader;

    public BAHTSTestCaseTesting() {

        super(Constants.TARGET_PACKAGE_ID, Constants.launcherActivityClass);

    }

    public void setUp() throws Exception {
        helpClass = new HelperActivity();
        this.activity = this.getActivity();
        solo = new Solo(getInstrumentation(), this.activity);
    }

    @Smoke
    public void testApp() throws IOException {
        System.out.println("Entered into debug panel");

//      ContentResolver cr = this.activity.getContentResolver();
//       solo.sleep(10000);
//      UpdateSettings updateSettings = new UpdateSettings(this.activity);
//      updateSettings.emulateMdn(MDN);
//      updateSettings.emulateDeviceId(DEVICEID);
//      updateSettings.enableWifi(WIFI);
//      updateSettings.updateURL(AM_URL, SYNC_RUL, null);

//       solo.goBack();
//       solo.sleep(10000);
         ArrayList<TextView> listTV = solo.getCurrentTextViews(null);
         String textView = null;
         for(TextView tv : listTV){
         textView = tv.getText().toString();
         System.out.println("Text Views:<"+textView+">");
         }

         solo.clickOnEditText(0);
         solo.clearEditText(0);
         solo.enterText(0, "Test@EXAMPLE.COM");
         System.out.println("USername entered");
         solo.clickOnEditText(1);
         solo.clearEditText(1);
         solo.enterText(1, "1234");
         solo.sleep(1000);
         solo.searchEditText("Remember login");
         solo.clickOnCheckBox(0);
         solo.sleep(1000);
         solo.searchButton("Sign In");
         solo.clickLongOnText("Sign In");
         System.out.println("Clicked on sign button");

        // ArrayList<ImageView> listImg = solo.getCurrentImageViews();
        // for(ImageView tv : listImg){
        // int imgX = tv.getScrollX();
        // int imgY = tv.getScrollY();
        // System.out.println("Image Views X:<"+imgX+">");
        // System.out.println("Image Views Y:<"+imgY+">");
        // }
//      DBUtility.deleteAllContacts(cr);
//      helpClass.addContactsToDb(cr);
//      helpClass.getContactsFromDb(this.activity);
//      helpClass.exportContactsDataToXML();
//      DBUtility.deleteAllContacts(cr);
        //solo.clickOnScreen(160, 270);

    }

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

            e.printStackTrace();
        }
        this.activity.finish();
        super.tearDown();
    }
}

Can any help wht went wrong & the error are as under :
10-21 13:17:11.402: DEBUG/AndroidRuntime(392): >>>>>> AndroidRuntime START 
com.android.internal.os.RuntimeInit <<<<<<
10-21 13:17:11.402: DEBUG/AndroidRuntime(392): CheckJNI is ON
10-21 13:17:11.562: INFO/jdwp(392): Ignoring second debugger -- accepting and 
dropping
10-21 13:17:12.032: DEBUG/AndroidRuntime(392): Calling main entry 
com.android.commands.am.Am
10-21 13:17:12.071: INFO/ActivityManager(61): Force stopping package 
com.fusionone.android.hts.sa uid=10030
10-21 13:17:12.092: INFO/ActivityManager(61): Start proc 
com.fusionone.android.hts.sa for added application 
com.fusionone.android.hts.sa: pid=400 uid=10030 gids={1006, 1015, 3003}
10-21 13:17:12.182: INFO/jdwp(400): Ignoring second debugger -- accepting and 
dropping
10-21 13:17:12.422: INFO/TestRunner(400): started: 
testApp(com.fusionone.android.sync.baclient.test.BAHTSTestCaseTesting)
10-21 13:17:12.443: INFO/ActivityManager(61): Starting: Intent { 
act=android.intent.action.MAIN flg=0x10000000 
cmp=com.fusionone.android.hts.sa/.Splash } from pid 400
10-21 13:17:13.212: WARN/IInputConnectionWrapper(158): showStatusIcon on 
inactive InputConnection
10-21 13:17:13.321: INFO/ActivityManager(61): Displayed 
com.fusionone.android.hts.sa/.Splash: +857ms
10-21 13:17:13.382: INFO/System.out(400): Entered into debug panel
10-21 13:17:13.382: INFO/System.out(400): Text Views:<Transfer Service>
10-21 13:17:13.382: INFO/System.out(400): Text Views:<TRANSFER SERVICE>
10-21 13:17:13.392: INFO/System.out(400): Text Views:<All Rights Reserved.>
10-21 13:17:13.392: INFO/System.out(400): Text Views:<Technologies, Inc.>
10-21 13:17:13.392: INFO/System.out(400): Text Views:<©1998-2011 Synchronoss>
10-21 13:17:16.081: WARN/dalvikvm(400): Class resolved by unexpected DEX: 
Lcom/fusionone/android/hts/sa/Launcher;(0x40516488):0x2b3e68 ref 
[Lcom/fusionone/hts/android/ServiceClient;] 
Lcom/fusionone/hts/android/ServiceClient;(0x40516488):0x296a70
10-21 13:17:16.081: WARN/dalvikvm(400): 
(Lcom/fusionone/android/hts/sa/Launcher; had used a different 
Lcom/fusionone/hts/android/ServiceClient; during pre-verification)
10-21 13:17:16.081: INFO/dalvikvm(400): Failed resolving 
Lcom/fusionone/android/hts/sa/Launcher; interface 294 
'Lcom/fusionone/hts/android/ServiceClient;'
10-21 13:17:16.081: WARN/dalvikvm(400): Link of class 
'Lcom/fusionone/android/hts/sa/Launcher;' failed
10-21 13:17:16.081: WARN/dalvikvm(400): threadid=10: thread exiting with 
uncaught exception (group=0x40015560)
10-21 13:17:16.102: ERROR/AndroidRuntime(400): FATAL EXCEPTION: Splash Timer
10-21 13:17:16.102: ERROR/AndroidRuntime(400): java.lang.NoClassDefFoundError: 
com.fusionone.android.hts.sa.Launcher
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
com.fusionone.android.hts.sa.Splash$1.run(Splash.java:49)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
java.util.Timer$TimerImpl.run(Timer.java:284)
10-21 13:17:16.102: ERROR/AndroidRuntime(400): Caused by: 
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to 
unexpected implementation
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
dalvik.system.DexFile.defineClass(Native Method)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
dalvik.system.DexFile.loadClassBinaryName(DexFile.java:207)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:200)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     ... 2 more
10-21 13:17:16.111: WARN/ActivityManager(61): Error in app 
com.fusionone.android.hts.sa running instrumentation 
ComponentInfo{com.fusionone.android.sync.baclient.test/android.test.Instrumentat
ionTestRunner}:
10-21 13:17:16.121: WARN/ActivityManager(61):   java.lang.IllegalAccessError
10-21 13:17:16.121: WARN/ActivityManager(61):   java.lang.IllegalAccessError: 
Class ref in pre-verified class resolved to unexpected implementation
10-21 13:17:16.121: DEBUG/AndroidRuntime(392): Shutting down VM
10-21 13:17:16.132: INFO/ActivityManager(61): Force stopping package 
com.fusionone.android.hts.sa uid=10030
10-21 13:17:16.142: DEBUG/dalvikvm(392): GC_CONCURRENT freed 106K, 71% free 
299K/1024K, external 0K/0K, paused 0ms+1ms
10-21 13:17:16.182: DEBUG/jdwp(392): Got wake-up signal, bailing out of select
10-21 13:17:16.182: DEBUG/dalvikvm(392): Debugger has detached; object registry 
had 1 entries
10-21 13:17:16.212: INFO/dalvikvm(392): JNI: AttachCurrentThread (from ???.???)
10-21 13:17:16.212: INFO/AndroidRuntime(392): NOTE: attach of thread 'Binder 
Thread #3' failed
10-21 13:17:16.262: INFO/Process(61): Sending signal. PID: 400 SIG: 9
10-21 13:17:16.292: ERROR/InputDispatcher(61): channel '40727918 
com.fusionone.android.hts.sa/com.fusionone.android.hts.sa.Splash (server)' ~ 
Consumer closed input channel or an error occurred.  events=0x8
10-21 13:17:16.292: ERROR/InputDispatcher(61): channel '40727918 
com.fusionone.android.hts.sa/com.fusionone.android.hts.sa.Splash (server)' ~ 
Channel is unrecoverably broken and will be disposed!
10-21 13:17:16.312: INFO/WindowManager(61): WIN DEATH: Window{40727918 
com.fusionone.android.hts.sa/com.fusionone.android.hts.sa.Splash paused=false}
10-21 13:17:16.501: WARN/InputManagerService(61): Got RemoteException sending 
setActive(false) notification to pid 400 uid 10030
10-21 13:17:16.541: INFO/dalvikvm(61): Jit: resizing JitTable from 1024 to 2048
10-21 13:20:56.454: DEBUG/SntpClient(61): request time failed: 
java.net.SocketException: Address family not supported by protocol
10-21 13:25:56.462: DEBUG/SntpClient(61): request time failed: 
java.net.SocketException: Address family not supported by protocol
10-21 13:30:56.516: DEBUG/SntpClient(61): request time failed: 
java.net.SocketException: Address family not supported by protocol
10-21 13:35:56.539: DEBUG/SntpClient(61): request time failed: 
java.net.SocketException: Address family not supported by protocol
10-21 13:40:56.575: DEBUG/SntpClient(61): request time failed: 
java.net.SocketException: Address family not supported by protocol
10-21 13:45:56.628: DEBUG/SntpClient(61): request time failed: 
java.net.SocketException: Address family not supported by protocol

Original issue reported on code.google.com by aloksing...@gmail.com on 21 Oct 2011 at 8:18

GoogleCodeExporter commented 9 years ago
Your problem lies in:

10-21 13:17:16.102: ERROR/AndroidRuntime(400): FATAL EXCEPTION: Splash Timer
10-21 13:17:16.102: ERROR/AndroidRuntime(400): java.lang.NoClassDefFoundError: 
com.fusionone.android.hts.sa.Launcher
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
com.fusionone.android.hts.sa.Splash$1.run(Splash.java:49)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
java.util.Timer$TimerImpl.run(Timer.java:284)
10-21 13:17:16.102: ERROR/AndroidRuntime(400): Caused by: 
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to 
unexpected implementation
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
dalvik.system.DexFile.defineClass(Native Method)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
dalvik.system.DexFile.loadClassBinaryName(DexFile.java:207)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:200)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
10-21 13:17:16.102: ERROR/AndroidRuntime(400):     ... 2 more

Original comment by renasr...@gmail.com on 21 Oct 2011 at 3:26

GoogleCodeExporter commented 9 years ago
i resolved my issue by debugging it.As my application pom contains old jar or 
dependency of another application which has the same dependency as of current 
working jar.

Thanks
alok Singh

Original comment by aloksing...@gmail.com on 23 Oct 2011 at 6:14

GoogleCodeExporter commented 9 years ago
A hello .... 
I'm facing a similar problem ... but dunno where can I find the pom file inside 
my test project ?

Original comment by mona.m.a...@gmail.com on 23 Mar 2014 at 2:46