sangmingming / robotium

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

recognize #212

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.When I want to searchText("*2"), seems it can't recognize "*"
2.Can Robotium recognize chinese word?
What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
3.0   xp

Please provide any additional information below.

Original issue reported on code.google.com by allen119...@gmail.com on 19 Jan 2012 at 1:48

GoogleCodeExporter commented 9 years ago
ok  it need regexp to search *

Original comment by allen119...@gmail.com on 19 Jan 2012 at 2:27

GoogleCodeExporter commented 9 years ago
Yep, takes your string as a regexp.

Original comment by renasr...@gmail.com on 19 Jan 2012 at 6:57

GoogleCodeExporter commented 9 years ago
But still have some trouble, I 
searchText("Ice.Age.2.The.Melt.Down.2006.HDre.x264.dts-SiLU-001")
sometimes it run succes, sometimes it run fail.
Actually, I saw filelist have 
"Ice.Age.2.The.Melt.Down.2006.HDre.x264.dts-SiLU-001" in my apk running.

Original comment by allen119...@gmail.com on 19 Jan 2012 at 9:26

GoogleCodeExporter commented 9 years ago
Can you please paste your test case?

Original comment by renasr...@gmail.com on 19 Jan 2012 at 10:02

GoogleCodeExporter commented 9 years ago
package com.xxx.ui.test;
import com.jayway.android.robotium.solo.Solo;
import android.test.ActivityInstrumentationTestCase2;

@SuppressWarnings("unchecked")
public class MMTesting extends ActivityInstrumentationTestCase2{
    private static final String TARGET_PACKAGE_ID = "com.xxx.ui.activity.main";
    private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME="com.xxx.ui.activity.main.MainActivity";
    private static Class<?> launcherActivityClass;
    static{
                try
                {
                    launcherActivityClass = Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
                }catch  (ClassNotFoundException e){
                    throw new RuntimeException(e);
                }
            }
    @SuppressWarnings("unchecked")
    public MMTesting() throws ClassNotFoundException{
        super(TARGET_PACKAGE_ID,launcherActivityClass);
    }
    private Solo solo;

    @Override
    protected void setUp()throws Exception{
        solo = new Solo(getInstrumentation(),getActivity());
    }
    public void test_Movie_H264_Ice_initial(){
        solo.clickOnImage(1); //enter video folder
        solo.assertCurrentActivity("Expected FileBrowserActivity", "FileBrowserActivity");
        //solo.clickOnText("Movie");
        solo.clickOnText("H264");
        solo.clickOnText("Ice.Age.2.The.Melt.Down");
        solo.assertCurrentActivity("Expected FileBrowserActivity", "VideoPlayActivity"); //in play activity

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

}

Original comment by allen119...@gmail.com on 19 Jan 2012 at 12:14

GoogleCodeExporter commented 9 years ago
So, your issue is that sometimes solo.clickOnText("Ice.Age.2.The.Melt.Down") 
returns that the string can not be found?

Original comment by renasr...@gmail.com on 19 Jan 2012 at 12:17

GoogleCodeExporter commented 9 years ago
yes, I try both "Ice.Age.2.The.Melt.Down.2006.HDre.x264.dts-SiLU-001" and 
"Ice.Age.2.The.Melt.Down.2006.HDre.x264.dts-SiLU-001"

Original comment by allen119...@gmail.com on 19 Jan 2012 at 12:43

GoogleCodeExporter commented 9 years ago
What happens if you try "Ice" or "Ice*"?

Original comment by renasr...@gmail.com on 19 Jan 2012 at 12:46

GoogleCodeExporter commented 9 years ago
I add solo.waitForText("Ice.Age.2.The.Melt.Down"); before that, it work better.
Maybe the text show slow than clickText

Original comment by allen119...@gmail.com on 19 Jan 2012 at 2:11

GoogleCodeExporter commented 9 years ago
ClickOnText() times out after 10 seconds if it can not find the correct text. 
Your issue is probably due to that.   

Original comment by renasr...@gmail.com on 19 Jan 2012 at 2:15

GoogleCodeExporter commented 9 years ago
I add solo.waitForText before ClickOnText(), and the total test finnish less 
than 10 seconds. 

Original comment by allen119...@gmail.com on 19 Jan 2012 at 2:26

GoogleCodeExporter commented 9 years ago
Is it successful every time now?

Original comment by renasr...@gmail.com on 19 Jan 2012 at 2:28

GoogleCodeExporter commented 9 years ago
yes, only testMethod it work fine, but run more testMethod sometimes still fial.

Original comment by allen119...@gmail.com on 19 Jan 2012 at 2:30

GoogleCodeExporter commented 9 years ago
only one

Original comment by allen119...@gmail.com on 19 Jan 2012 at 2:30

GoogleCodeExporter commented 9 years ago
Do you notice anything strange when observing an execution that fails? Is it 
when the app/emulator is slow?

Original comment by renasr...@gmail.com on 19 Jan 2012 at 2:36

GoogleCodeExporter commented 9 years ago
Below is using adb logcat message, before I add waitText.
================================================================================
I/ActivityManager(  773): Starting: Intent { cmp=com.xxx.ui.activity.main/.Fil
eBrowserActivity (has extras) } from pid 1550
D/dalvikvm( 1550): GC_EXTERNAL_ALLOC freed 143K, 48% free 2860K/5447K, external
6886K/6905K, paused 24ms
I/System.out( 1550): currentOption: 2
D/szipinf ( 1550): Initializing inflate state
D/szipinf ( 1550): Initializing zlib to inflate
D/szipinf ( 1550): Initializing inflate state
D/szipinf ( 1550): Initializing zlib to inflate
D/szipinf ( 1550): Initializing inflate state
D/szipinf ( 1550): Initializing zlib to inflate
D/szipinf ( 1550): Initializing inflate state
D/szipinf ( 1550): Initializing zlib to inflate
D/dalvikvm( 1550): GC_EXTERNAL_ALLOC freed 8K, 48% free 2862K/5447K, external 67
15K/8386K, paused 25ms
D/dalvikvm( 1550): GC_EXTERNAL_ALLOC freed 4K, 48% free 2871K/5447K, external 10
356K/12192K, paused 24ms
I/System.out( 1550): ActivityHandler msg.what: 0
I/System.out( 1550): isOnCreate: truecurrentOption: 2
I/ActivityManager(  773): Displayed com.xxx.ui.activity.main/.FileBrowserActiv
ity: +809ms
I/System.out( 1550): updateListViewHandler msg.what: 0
I/System.out( 1550): videoFolderNum: 3
I/System.out( 1550): leftCount: -7
D/dalvikvm( 1550): GC_EXTERNAL_ALLOC freed 31K, 46% free 2949K/5447K, external 1
3357K/14679K, paused 25ms
I/System.out( 1550): onItemClick: arg2: 1, arg3: 1
I/System.out( 1550): ActivityHandler msg.what: 1
I/System.out( 1550): updateListViewHandler msg.what: 1
I/InputQueue-JNI( 1550): Sending finished signal for input channel '408c1560 com
.xxx.ui.activity.main/com.xxx.ui.activity.main.FileBrowserActivity (client)'
 since it is being unregistered while an input message is still in progress.
I/InputQueue-JNI( 1550): Ignoring finish signal on channel that is no longer reg
istered.
W/InputManagerService(  773): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy@409e3068
D/dalvikvm(  855): GC_EXPLICIT freed 47K, 52% free 2872K/5959K, external 683K/10
17K, paused 24ms
D/dalvikvm(  874): GC_EXPLICIT freed 7K, 49% free 3018K/5895K, external 1971K/24
83K, paused 35ms
W/InputDispatcher(  773): Permission denied: injecting event from pid 1550 uid 1
0032 to window with input channel 408741f8 com.android.launcher/com.android.laun
cher2.Launcher (server) owned by uid 10010
W/WindowManager(  773): Input event injection permission denied.
D/dalvikvm( 1550): GC_EXPLICIT freed 230K, 48% free 3002K/5703K, external 15862K
/17327K, paused 25ms
D/dalvikvm( 1550): GC_EXPLICIT freed 15K, 48% free 2986K/5703K, external 12990K/
15038K, paused 25ms
I/TestRunner( 1550): failed: test_Movie_H264_Ice_initial(com.xxx.ui.test.MMTes
ting)
I/TestRunner( 1550): ----- begin exception -----
I/TestRunner( 1550):
I/TestRunner( 1550): junit.framework.ComparisonFailure: Expected FileBrowserActi
vity expected:<VideoPlay...> but was:<FileBrowser...>
I/TestRunner( 1550):    at junit.framework.Assert.assertEquals(Assert.java:81)
I/TestRunner( 1550):    at com.jayway.android.robotium.solo.Asserter.assertCurre
ntActivity(Asserter.java:42)
I/TestRunner( 1550):    at com.jayway.android.robotium.solo.Solo.assertCurrentAc
tivity(Solo.java:555)
I/TestRunner( 1550):    at com.xxx.ui.test.MMTesting.test_Movie_H264_Ice_initi
al(MMTesting.java:133)
I/TestRunner( 1550):    at java.lang.reflect.Method.invokeNative(Native Method)
I/TestRunner( 1550):    at java.lang.reflect.Method.invoke(Method.java:507)
I/TestRunner( 1550):    at android.test.InstrumentationTestCase.runMethod(Instru
mentationTestCase.java:204)
I/TestRunner( 1550):    at android.test.InstrumentationTestCase.runTest(Instrume
ntationTestCase.java:194)
I/TestRunner( 1550):    at android.test.ActivityInstrumentationTestCase2.runTest
(ActivityInstrumentationTestCase2.java:186)
I/TestRunner( 1550):    at junit.framework.TestCase.runBare(TestCase.java:127)
I/TestRunner( 1550):    at junit.framework.TestResult$1.protect(TestResult.java:
106)
I/TestRunner( 1550):    at junit.framework.TestResult.runProtected(TestResult.ja
va:124)
I/TestRunner( 1550):    at junit.framework.TestResult.run(TestResult.java:109)
I/TestRunner( 1550):    at junit.framework.TestCase.run(TestCase.java:118)
I/TestRunner( 1550):    at android.test.AndroidTestRunner.runTest(AndroidTestRun
ner.java:169)
I/TestRunner( 1550):    at android.test.AndroidTestRunner.runTest(AndroidTestRun
ner.java:154)
I/TestRunner( 1550):    at android.test.InstrumentationTestRunner.onStart(Instru
mentationTestRunner.java:529)
I/TestRunner( 1550):    at android.app.Instrumentation$InstrumentationThread.run
(Instrumentation.java:1448)
I/TestRunner( 1550): ----- end exception -----
I/TestRunner( 1550): finished: test_Movie_H264_Ice_initial(com.xxx.ui.test.MMT
esting)
I/Process (  773): Sending signal. PID: 1550 SIG: 9
D/AndroidRuntime( 1542): Shutting down VM
D/dalvikvm( 1542): GC_CONCURRENT freed 124K, 71% free 301K/1024K, external 0K/0K
, paused 0ms+0ms
I/ActivityManager(  773): Force stopping package com.xxx.ui.activity.main uid=
10032
I/AndroidRuntime( 1542): NOTE: attach of thread 'Binder Thread #3' failed
D/dalvikvm( 1542): Debugger has detached; object registry had 1 entries

Original comment by allen119...@gmail.com on 19 Jan 2012 at 2:51

GoogleCodeExporter commented 9 years ago
after add waitForText()
===================================================================
I/ActivityManager(  773): Starting: Intent { cmp=com.xxx.ui.activity.main/.Fil
eBrowserActivity (has extras) } from pid 1669
D/dalvikvm( 1669): GC_EXTERNAL_ALLOC freed 131K, 48% free 2872K/5447K, external
6886K/6905K, paused 24ms
I/System.out( 1669): currentOption: 2
D/szipinf ( 1669): Initializing inflate state
D/szipinf ( 1669): Initializing zlib to inflate
D/szipinf ( 1669): Initializing inflate state
D/szipinf ( 1669): Initializing zlib to inflate
D/szipinf ( 1669): Initializing inflate state
D/szipinf ( 1669): Initializing zlib to inflate
D/szipinf ( 1669): Initializing inflate state
D/szipinf ( 1669): Initializing zlib to inflate
D/dalvikvm( 1669): GC_EXTERNAL_ALLOC freed 8K, 48% free 2874K/5447K, external 67
15K/8279K, paused 24ms
D/dalvikvm( 1669): GC_EXTERNAL_ALLOC freed 4K, 48% free 2884K/5447K, external 10
356K/12192K, paused 24ms
I/System.out( 1669): ActivityHandler msg.what: 0
I/System.out( 1669): isOnCreate: truecurrentOption: 2
I/System.out( 1669): updateListViewHandler msg.what: 0
I/System.out( 1669): videoFolderNum: 3
I/System.out( 1669): leftCount: -7
I/ActivityManager(  773): Displayed com.xxx.ui.activity.main/.FileBrowserActiv
ity: +836ms
D/dalvikvm( 1669): GC_EXTERNAL_ALLOC freed 31K, 46% free 2961K/5447K, external 1
3357K/14679K, paused 25ms
I/System.out( 1669): onItemClick: arg2: 1, arg3: 1
I/System.out( 1669): ActivityHandler msg.what: 1
I/System.out( 1669): updateListViewHandler msg.what: 1
W/InputManagerService(  773): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy@409a6fa0
D/dalvikvm( 1669): GC_CONCURRENT freed 265K, 48% free 3025K/5767K, external 1586
2K/17327K, paused 2ms+2ms
I/System.out( 1669): onItemClick: arg2: 2, arg3: 2
I/System.out( 1669): /mnt/usb/sda1/Movie/H264/Ice.Age.2.The.Melt.Down.2006.HDre.
x264.dts-SiLU-001.mkv
I/ActivityManager(  773): Starting: Intent { cmp=com.xxx.ui.activity.main/com.
xxx.ui.activity.video.VideoPlayActivity (has extras) } from pid 1669
I/System.out( 1669): video_path/mnt/usb/sda1/Movie/H264/Ice.Age.2.The.Melt.Down.
2006.HDre.x264.dts-SiLU-001.mkv
W/System.err( 1669): videoList size3

Original comment by allen119...@gmail.com on 19 Jan 2012 at 2:55

GoogleCodeExporter commented 9 years ago
try use "Ice*" replace "Ice.Age.2.The.Melt.Down" it also work fine

Original comment by allen119...@gmail.com on 19 Jan 2012 at 2:59

GoogleCodeExporter commented 9 years ago
Every time?
Den 19 jan 2012 16:00 skrev <robotium@googlecode.com>:

Original comment by renasr...@gmail.com on 19 Jan 2012 at 3:01

GoogleCodeExporter commented 9 years ago
just try one test method five times and run success, need more time to test it 
whether work fine every time.

Original comment by allen119...@gmail.com on 19 Jan 2012 at 5:08