문제

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

도움이 되었습니까?

해결책

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()

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top