Closed GoogleCodeExporter closed 9 years ago
To clarify (as I am sitting here watching the test run), I notice that the
proper activity does open and run ( and sometimes even succeeds! ), and that it
often fails even though it is correct. I triple checked all of my
activity.class params, and they are correct.
Original comment by Phill.Z...@gmail.com
on 11 Oct 2012 at 9:24
may be should give solo.sleep() between call and assertion. Sometimes clicks on
app/Text but before it takes time to open it,assertion will be done.
Original comment by manas...@gmail.com
on 12 Oct 2012 at 5:39
This actually makes the problem worse. Adding in solo.sleep() between call and
assertion, with various params between 500 and 5000, causes one of the checks
(again, a random one each time) to fail for sure.
Original comment by Duno...@gmail.com
on 12 Oct 2012 at 5:35
Tested a set of tests on a hard device, and every test passed perfected ( I did
end up having to add in some solo.sleep(...) methods). Ran the same code on an
emulator, and every single test barfed. Seems to be a problem stemming from the
emulator interfacing.
Original comment by Phill.Z...@gmail.com
on 12 Oct 2012 at 9:27
Thanks for reporting this. What version of Android are you running the tests on
when using the emulator?
What assertion failed message does assertCurrentActivity() give you when it
fails? Is the issue that it wrongly reports back that another activity is
shown? Any patterns when looking at the assertion messages?
Original comment by renasr...@gmail.com
on 15 Oct 2012 at 8:29
I run 4.0.3 normally, though I tested it on 4.1 today and came to the same
problem. Extending all of my waits out to 10s or more helped, but still has not
cleared the problem.
The fail message is the string that I hand it, "Activity Wrong" and "expected
<...> but was <...>". The assertion messages don't seem to have any pattern.
The assertions tend to fail on at a different location than the previous run.
I did some more testing, and it seems to be a problem with the emulator. I made
a new emulator of 4.0.3 using the x86 Atom and an HVGA screen ( instead of the
standard WVGA ) and everything seems to work fine. I will do some more testing,
but I am 80% confident that this is a problem with the emulator, and not
Robotium.
Original comment by Phill.Z...@gmail.com
on 15 Oct 2012 at 9:31
As with most of these testing frameworks, you "simply" need to make your tests
more robust. Test will always fail randomly if you don't first make sure you
are ready for testing the assertion ("synchronize"), specially in emulators
because they are much slower and seem to be *randomly* slow at points (this is
extremely annoying). For example, if you're loading something, wait until the
loading indicator has disappeared before checking if the text is correct. Using
sleep() calls is very haphazard and not ideal, you will probably end up waiting
much more time than needed in general and still run into many random failures.
Original comment by david...@gmail.com
on 15 Nov 2012 at 3:49
Will open up again if new information is given.
Original comment by renasr...@gmail.com
on 19 Nov 2012 at 6:49
Well,
I've got a similar problem and what I've also found is that the more test
methods are in a test class, the more of them start failing, though no problems
if running any of the failed methods separately several times in a row.
Original comment by resident...@gmail.com
on 13 Jun 2013 at 2:09
I'm also facing same issue
Original comment by Sameena....@gmail.com
on 16 Jul 2013 at 7:51
i m also facing the same issue
Original comment by narendra...@gmail.com
on 4 Jun 2014 at 10:56
I also have the same problem. When I run the test on device it runs perfectly,
but when it comes to emulator and jenkins it fails randomly, passes randomly.
Not knowing the reason, tried all sorts of things none of them worked for me.
Original comment by ravisrav...@gmail.com
on 25 Jul 2014 at 1:17
Facing the same issue.. the application loads one activity and the test detects
it as some other activity(any other activity from same application) and the
problem increases because the behavior is not similar on each test run.. the
test failure is not linked to any particular activity.
Original comment by phani...@gmail.com
on 15 Sep 2014 at 4:15
Original issue reported on code.google.com by
Phill.Z...@gmail.com
on 11 Oct 2012 at 9:09