Question

I want to automate a test case like.

I have two activities and in the first activity I am downloading the data from server and then I navigate to the second activity. so after coming back to first activity the state of the progress bar which i m using to show the download percentage should be retained/saved.

for this requirement I want to write a test case.Please suggest me a solution/example on design/code If you have.

Help is always appreciated, Thanks

Regards Raghu

Was it helpful?

Solution

I suppose that you use a button with text to navigato to the second Activity, so you can try

solo.clickOnText("second activity");
solo.waitForActivity(YOUR_ACTIVITY_CLASS);
solo.goBack();  // back to the first activity

ProgressBar pb = (ProgressBar)solo.getCurrentActivity().findViewById(YOUR_PB_ID);
int progress = pb.getProgress();  // here you have the progressbar value

See more here: http://developer.android.com/reference/android/widget/ProgressBar.html#getProgress()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top