lihuazhang / robotium

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

Some basic actions fail #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
"solo.clickOnButton("Yes");" assert-fails with "Button with the text: Yes is 
not found!", while the text Yes on a button in a dialog is clearly on screen. 
Similarly, "solo.clearEditText(0);" assert-fails because "EditText with index 0 
is not available!". And the full test I run on Collectionista has up to and 
about 44 of these kind of failures. This test runs correct on Robotium-1.7.1. 
Sometimes, these actions will succeed, but in a minority of cases. For example, 
"solo.clearEditText(0);" will pass, but then the next line "solo.enterText(0, 
...);" might fail for the same reason.

What is the expected output? What do you see instead?
These actions should succeed.

What version of the product are you using? On what operating system?
Robotium 2.1 but 2.0 also exhibits this. 1.7.1 did not.

Please provide any additional information below.
I would look into a timing issue (looks a lot like bug #61). It could be 
coincidence but I've seen it only in conjunction with dialogs (i.e. where an 
activity is visible in the background, but not active).

The Collectionista Alpha test suite: 
https://code.launchpad.net/~pjv/collectionista/tests-for-alpha  rev. 68

Original issue reported on code.google.com by ezelspin...@gmail.com on 7 Feb 2011 at 10:27

GoogleCodeExporter commented 9 years ago
Thanks for this pjv. Can you please email me the collectionista apk?

Original comment by renasr...@gmail.com on 8 Feb 2011 at 6:19

GoogleCodeExporter commented 9 years ago
Absolutely.
I have the same issues.

Original comment by yair.oha...@gmail.com on 8 Feb 2011 at 9:37

GoogleCodeExporter commented 9 years ago
Yair,

Did it use to work correctly for you as well too? Do you see this only in 
dialogs or also elsewhere?

Original comment by ezelspin...@gmail.com on 8 Feb 2011 at 9:53

GoogleCodeExporter commented 9 years ago
I see it when testing a tab application.
After switching back and forth between tabs the search does't find any of the 
items (no scrolling involoved).

Original comment by yair.oha...@gmail.com on 9 Feb 2011 at 6:30

GoogleCodeExporter commented 9 years ago
Yair, So first it finds the items but after you switch back and forth it does 
not find them anymore?

Original comment by renasr...@gmail.com on 9 Feb 2011 at 6:34

GoogleCodeExporter commented 9 years ago
Exactly.
I tried the click on text method and the log from solo - indicated specifically 
"robotium cannot find the "something" string"

I have more items which occurred one i moved from version 1.7.1 to 2.1 -
almost 40% percent of my tests failed (i have about 200 - only one app).
some of the issues are minor (like the redundant call to solo.goBack() after 
enter text...
The general feeling is that the faster test execution sometimes causing other 
failures...

Original comment by yair.oha...@gmail.com on 9 Feb 2011 at 6:46

GoogleCodeExporter commented 9 years ago
Yair, Would it be possible/allowed for you to send me your application?

Original comment by renasr...@gmail.com on 9 Feb 2011 at 6:50

GoogleCodeExporter commented 9 years ago
I'll try to create a test project for you.
It's a side job for me so it'll take a few days.
is it ok ?

Original comment by yair.oha...@gmail.com on 9 Feb 2011 at 6:52

GoogleCodeExporter commented 9 years ago
That would be great. Thanks a lot.

Original comment by renasr...@gmail.com on 9 Feb 2011 at 6:53

GoogleCodeExporter commented 9 years ago
No! Thank you.
This amazing test framework enables me to cut regression tests and super fast 
release cycle.
You're doing amazing , beautiful software and should be proud in your work.

Original comment by yair.oha...@gmail.com on 9 Feb 2011 at 6:55

GoogleCodeExporter commented 9 years ago
Thanks. That makes me happy :) I am looking forward to fixing these issues so 
that the next version will be better.

Original comment by renasr...@gmail.com on 9 Feb 2011 at 7:00

GoogleCodeExporter commented 9 years ago
Yeah, thumbs up from me as well. I only had hoped you'd be running 
Collectionista as part of your continuous autotesting for robotium by now, wink 
wink, ;-P.

Renas, I have been able to solve one of my problems by disabling the ifs on 
line 116 and 118 in ViewFetcher.java, as such:

if(!activity.hasWindowFocus() || true){
    for(View view : views){
        if(!activity.getWindow().getDecorView().equals(view) || true){

This has nothing to do with a proper fix, but should give you an insight in 
where the bug may lurk.

I'll attach a robotium jar here, but don't expect it to automagically solve all 
problems or not to create any new ones. I have yet to test the full suite on it 
myself. Still, Yair, can you try it?

Original comment by ezelspin...@gmail.com on 9 Feb 2011 at 9:05

Attachments:

GoogleCodeExporter commented 9 years ago
I forgot to say, but best to try it only on your problematic tests.

Original comment by ezelspin...@gmail.com on 9 Feb 2011 at 9:06

GoogleCodeExporter commented 9 years ago
Thanks. I will have to look into it.

Original comment by renasr...@gmail.com on 9 Feb 2011 at 9:30

GoogleCodeExporter commented 9 years ago
I know were the problem lies but need to figure out a good solution for it.
A test app from Yair would help.

Original comment by renasr...@gmail.com on 9 Feb 2011 at 9:35

GoogleCodeExporter commented 9 years ago
The other jar didn't solve my issues...
This is the code and test all bundeled nicely together - 
you can see all the comments on tests which i gave up on.

Original comment by yair.oha...@gmail.com on 9 Feb 2011 at 9:55

Attachments:

GoogleCodeExporter commented 9 years ago
Hmm, Yair, then I think your issue is a different one. That jar file really 
significantly reduces my failures, though it introduces a few new ones (where 
not enough views are filtered; - my fix basically does less filtering of views).

Original comment by ezelspin...@gmail.com on 9 Feb 2011 at 10:04

GoogleCodeExporter commented 9 years ago
Probably is.
The most annoying thing is that when i get list of failures and executing them 
one be one - some are passing the test successfully and some - still fails. 
it's not consistent.
Trying to debug some of the persistent issue - caused the test to pass too.

No doubt a timing issue.
It's driving me crazy!!! (I don't need to say its passed on 1.7.1 right ?)
BTW - where can i get zip of sources ? - github is taking forever to bring 
sources...

Original comment by yair.oha...@gmail.com on 9 Feb 2011 at 10:13

GoogleCodeExporter commented 9 years ago
Yair, your problem is definetly a timing issue. I will have a look at it. 
Thanks for sharing the application. 

Original comment by renasr...@gmail.com on 10 Feb 2011 at 5:35

GoogleCodeExporter commented 9 years ago
Please ignore my request for sources - 
The download link  on github - started to work - i will better understanding of 
whats going on with the source.

Original comment by yair.oha...@gmail.com on 10 Feb 2011 at 1:26

GoogleCodeExporter commented 9 years ago
This issue has been fixed in Robotium 2.2.

Original comment by renasr...@gmail.com on 21 Feb 2011 at 6:01