Re: Testing ListView in Robotium

3,655 views
Skip to first unread message

Renas Reda

unread,
Jul 13, 2012, 2:28:06 AM7/13/12
to Robotium Developers
Hi,

You can use getView() to get a hold of a view. ClickOnView() to click
on a view in the list. ClickOnText, searchText(), scroll, etc all
works in lists as well.

You can use clickInList(int listLine) as well to click on different
list lines.


/Renas

On Jul 12, 1:29 pm, Umesh G <umiii...@gmail.com> wrote:
> Hi,
>
> I have a list view in my activity, I'm just looking for information on how
> to test the list view for ex:
>
> 1. Browse through each item in listview
> 2. Search the ImageView in each Item with a given R.id and click on that
> ImageView
>
> Please suggest me on how can i achieve above in Robotium

naveed

unread,
Jul 14, 2012, 7:19:20 AM7/14/12
to robotium-...@googlegroups.com
For example if you want to play with texts into your list use following code 

ListView vMainList = solo.getCurrentListViews().get(0);
ArrayList<TextView> vTiles = new ArrayList<TextView>();
vTiles = solo.getCurrentTextViews(vMainList);
Log.i("Total number of texts into list are ", vTiles.size());
for(int i = 0; i<vTiles.size(); i++)
Log.i(" ", vTiles.get(i).getText().toString());

same you can play with other contents as well

Enjoy Testing :)

Mark

unread,
Nov 1, 2012, 12:12:10 AM11/1/12
to robotium-...@googlegroups.com
hello , all :

How to generate test result report by code in robotium ? Sometimes
the device disconnects with pc, So I can save the test info into sd card.

Can any one share a simple code for me?

thanks very much,
Any reply will be appreciated.


/mark ma

rajesh dasi

unread,
Nov 1, 2012, 3:36:15 AM11/1/12
to robotium-...@googlegroups.com
Hi Mark

I'm also looking for same kind of Implementation where the result should be saved in a excel sheet. I'll be so happy some one can help me out in this.

Regards
Rajesh.D

Sunil Alapati

unread,
Nov 1, 2012, 10:25:10 AM11/1/12
to robotium-...@googlegroups.com
Try missing android xml junit test runner. Its pretty straight forward to implement. Basically the reports will be in the form of junit html report pattern not in excel format.

For more info please refer below link:

Let me know how it goes!

Happy scripting!!!

Regards
Sunil



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


Rodislav Moldovan

unread,
Jul 9, 2013, 11:47:41 AM7/9/13
to robotium-...@googlegroups.com
here is how I did it

        solo.sleep(2000);
        solo.waitForView(R.id.search_icon);

        ListView view = (ListView) solo.getView(R.id.contacts);
        Adapter adapter = view.getAdapter();
        assertNotSame(view.getAdapter().getCount(), 0);

        UserContactDTO user = (UserContactDTO) adapter.getItem(0);
        solo.clickOnText(user.getInfo().getFullName());

        solo.sleep(3000);

In this way I clicked on specific item from listview
Reply all
Reply to author
Forward
0 new messages