Issue with Test class SingleLaunchActivityTestCase

by cg-dev » Fri, 04 Mar 2011 18:41:48 GMT


Sponsored Links
 Hi,

We're developping a test activity using SingleLaunchActivityTestCase<>
and JUnit on Android 2.3.3

We face the following issue :

In JUnit view in eclipse we have the following function call order :

testActivityTestCaseSetUpProperly() <- this one is built in android.
testA()
testB()
testC()

Each test use sendKeys() or TouchUtils.clickView().

On testC() sometimes we get this error :
W/InputDispatcher(  112): Permission denied: injecting event from pid
3753 uid 10001 to window with input channel 406a0b70
com.android.launcher/com.android.launcher2.Launcher (server) owned by
uid 10022

??? Launcher (desktop) get Events ??? We do nothing for that


So I put a Thread.sleep(5000) in testC() at the beginning.

I launch the test again :

testActivityTestCaseSetUpProperly() : Ok
testA() : Ok
testB() : Ok
Here application is put in background (for no reason we do not call
activity.finish() and co.)
testC() is launched but desktop is display. The test failed as we
cannot inject events to desktop.

The workaround for this is to create a dummy testZZZZ() function in
that way, testC() is executed before activity get closed.

testActivityTestCaseSetUpProperly() : Ok
testA() : Ok
testB() : Ok
testC() : Ok
testZZZZ() : don't care of result.

NOTE : sometimes the function order change :

testA()
testB()
testC()
testActivityTestCaseSetUpProperly()

In that way, the issue is not visible.


Hope it helps.





-- 



Re: Issue with Test class SingleLaunchActivityTestCase

by cg-dev » Fri, 04 Mar 2011 18:46:07 GMT


 I notice this in SingleLaunchActivityTestCase.java:

@Override
    protected void tearDown() throws Exception {
        // If it is the last test case, call finish on the activity.
        sTestCaseCounter --;
        if (sTestCaseCounter == 1) {
            sActivity.finish();
        }
        super.tearDown();
    }
This : "if (sTestCaseCounter == 1)" should be replaced by "if
(sTestCaseCounter == 0)" ?

Regards.




-- 


Sponsored Links


Other Threads

1. copying my application package to android x86 eeepc running in vmware

You may need to set the adb target:
under linux:
  export ADBHOST=your_vmware_target_ip
under windows:
  set ADBHOST=your_vmware_target_ip
then try to start the adb server. if you have already started the
server, you need to kill it firstly by: adb kill-server
If you are using NAT network in VMware, your target may only be
reachable to the host.
hope it helps!
--
 Chen






--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Unable to open persistent property director

hi Brian:
   You are using the installer.img which is used to work as a USB
installer for eeepc, after it installs, it can start the gui
correctly.
--
 Chen








--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. copying my application package to android x86 eeepc running in vmware

4. Unable to open persistent property director

5. Join new Linux community

6. Want a background Service to show Toasts on Device Screen

7. Android Video Capturing