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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -