Mathias Lin
unread,Oct 11, 2010, 11:04:53 PM10/11/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Robotium Developers
I just got started with Robotium and tried a first very simple test,
but experience some problem which I can't explain / doesn't seem logic
to me.
I have a TabHost with a ActivityGroup and a toggle button on each
activity that's displayed in the tabhost content section. When I press
the toggle button, the tab content area changes to another activity
(mTabHost.setCurrentTab(Intent intent);). Every activity holds such a
toggle button, always with a label "Toggle". When I click the toggle
button on the seconds activity, it will switch back to the first (all
inside the tab content area).
|-----------------|
| TabHost | |
|-----------------|
| |
| Toggle-Button |
| |
| (Activities |
| change in here) |
| |
|-----------------|
Now, manually this all works fine, but the robotium test doesn't. When
I attempt to click the toggle button on the second activity, I get an
error message "junit.framework.AssertionFailedError: View can not be
clicked!"
This is my test - very simple and small:
solo.sleep(5000);
solo.waitForActivity("StartTabsActivity", 10000);
solo.clickOnButton("Toggle");
// this will swap the activity inside the tabhost content
section
solo.sleep(5000);
solo.waitForActivity("StatusListActivity", 5000);
solo.assertCurrentActivity("Expected StatusList activity",
"StatusListActivity");
LogUtils.logD("robotium: button label: " +
solo.getButton(1).getText());
// ... outputs: robotium: button label: Toggle
LogUtils.logD("robotium: button clickable: " +
solo.getButton(1).isClickable());
// ... outputs: robotium: button clickable: true
solo.clickOnButton("Toggle");
// ... throws: junit.framework.AssertionFailedError: View can
not be clicked!
What I don't understand here: I am checking that the button with
"Toggle" label exists and is clickable, nevertheless, I'm getting an
error saying "This view cannot be clicked.". And there's only one
"Toggle" button in the respective current activity.
Related to this question I have another minor one:
When I work with TabHost + ActivityGroup, will
"solo.getCurrentActivity()" always return the embedded activity of the
ActivityGroup, not the outer one? Can solo still access elements of
the outer activity though?
In my above case though, the toggle button is always part of the inner/
embedded activity - in case that matters here.