Testing activities with Animations

460 views
Skip to first unread message

marekdef

unread,
Jun 20, 2011, 4:22:32 PM6/20/11
to Robotium Developers, kgu...@gmail.com
Hi,

We have activities that use animation for additional effects.
When launching robotium test cases we discovered that the test stalls.

Debugging shows that we wait for idle handler to release the lock.
This is inside Instrumentation class
http://www.google.com/codesearch#uX1GffpyOZk/core/java/android/app/Instrumentation.java&q=Instrumentation%20lang:%5Ejava$&type=cs&l=395
so is not 100% related to robotium but I believe people here do a lot
of testing,
so my question is:
- how can we test activities that use animations?
- Is there a trick to use robotium as well in such cases?

PS: I think I could do the test when steering clear of waitForIdleSync
method, which unfortunately is used in many robotium functions.

Renas

unread,
Jun 21, 2011, 12:45:03 AM6/21/11
to robotium-...@googlegroups.com
Hi,

Please see the following post:


/Renas


--
You received this message because you are subscribed to the Google Groups "Robotium Developers" group.
To post to this group, send email to robotium-...@googlegroups.com.
To unsubscribe from this group, send email to robotium-develo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/robotium-developers?hl=en.


marekdef

unread,
Jun 21, 2011, 2:54:58 AM6/21/11
to Robotium Developers
Hi Renas,

Thanks for that I have already seen that.
This is not the case which we have.

Perhaps this will tell you more (hope this gist is visible).

https://gist.github.com/0e00722c11059bfe513f

Basically getActivity() method causes the test to wait when
AnimationActivity goes idle, which never happens due to infinite
animation repeatCount="-1".

I can start activity with intent as a workaround but all robotium
functions have waitForIdleSync() beneath which will cause the same
pause.

On 21 Cze, 06:45, Renas <renasr...@gmail.com> wrote:
> Hi,
>
> Please see the following post:
>
> http://groups.google.com/group/robotium-developers/browse_thread/thre...
>
> <http://groups.google.com/group/robotium-developers/browse_thread/thre...>/Renas
>
>
>
>
>
>
>
> On Mon, Jun 20, 2011 at 10:22 PM, marekdef <marek...@gmail.com> wrote:
> > Hi,
>
> > We have activities that use animation for additional effects.
> > When launching robotium test cases we discovered that the test stalls.
>
> > Debugging shows that we wait for idle handler to release the lock.
> > This is inside Instrumentation class
>
> >http://www.google.com/codesearch#uX1GffpyOZk/core/java/android/app/In...

Renas

unread,
Jun 21, 2011, 3:04:00 AM6/21/11
to robotium-...@googlegroups.com
Hi Marek,

Unfortunetaly the waitForIdleSync() method calls are needed due to timing issues. 

/Renas

gregg rivinius

unread,
Aug 17, 2011, 10:43:16 AM8/17/11
to Robotium Developers
Hi Marek,

Did you ever find a solution to allow the use of infinite animations
while running robotium tests? We are having the same exact issue and
prefer to not have to disable animations when testing our
application.

Thanks
--Gregg

Ro Ko

unread,
Aug 18, 2011, 6:06:53 AM8/18/11
to Robotium Developers
Hey,

we have the issue with greendroid library and pageindicator showing
more than one dot. I believe it has something to do with the animation
"bug".
Is there something new? Could i do a check in my activity, either it
is running an instrumentation test or not? This way i could workaround
the bug.

marekdef

unread,
Aug 18, 2011, 7:40:06 AM8/18/11
to Robotium Developers
Hi,

No, I did not solve the problem.

I may have some suggestions but take this without prejudice, you have
to explore on your own:

1. Try to reimplement getActivity() so it does not call
waitForIdleSync ?

I think we could use postDelayed instead of waiting for idle state
with idle handler,
if you succeed for robotium you would need to implement the same
mechanism.

2. Use --no_window_animation

Is used by google's test runner

http://www.google.com/codesearch#CRBM04-7BoA/testrunner/adb_interface.py&q=%22--no_window_animation%22&type=cs&l=283

and somewhere in am command is indeed taken into account

http://www.google.com/codesearch#uX1GffpyOZk/cmds/am/src/com/android/commands/am/Am.java&q=%22--no_window_animation%22&type=cs&l=364

but I am not sure if this really works.

3. Take a look at
http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NO_ANIMATION

quick glance on this flag says is not exactly what we need but maybe
will give some clues?
Maybe this flag could be used by activities to not run animations? I
mean that developers will write activities having in mind that
animation could be disabled by this flag?

Regards.
Reply all
Reply to author
Forward
0 new messages