java - Android : Avoid app to quit after automation testing -
i writing android automation test using robotium , after successful test, want take screenshot of app.
the problem application quits after test completed , job screen capture takes home screenshot not desired.
is there way stop application quit app screen active , desired screenshot?
below test case have written. also, not using teardown
activity.
public class mytest extends activityinstrumentationtestcase2 { private static final string launch_activity_name = "com.demo.activity.myactivity"; private solo solo; private static class<?> splashactivityclass; static { try { splashactivityclass = class.forname(launch_activity_name); } catch (classnotfoundexception e) { throw new runtimeexception(e); } } public test() throws classnotfoundexception { super(splashactivityclass); } @override protected void setup() throws exception { solo = new solo(getinstrumentation(), getactivity()); } @suppresslint({ "simpledateformat", "newapi" }) public void testallcountries() { // test goes here... }
i taking screenshot via adb
command execute in separate job using java runtime
.
i ran same issue little while ago, when screenshots keeping not in sync tests executing. managed adding simple
solo.sleep(1000);
after taking screenshot.
hope can too
Comments
Post a Comment