Silk Mobile

Table of Contents (Homepage)

Exit

void exit()

Note: This command can only be added in the code environment

images/images/os-icons/os_ios_150x150.png

images/images/os-icons/os_android_150x150.png

images/images/os-icons/os_windows_150x150.png

images/images/os-icons/os_blackberry_150x150.png

Description

The command will close Silk Mobile during runtime.

This is the only command to use for this purpose.

Parameters

No parameters.

Usage

Scenario: In the following example we will run a small test on the EriBank application and after the report is generated, on the tearDown method we will run the exit() command to close Silk Mobile service.

Java Example
publicclass Untitled {
private String host = "localhost";
private int port = 8889;
protected Client client = null;
@Before
public void setUp(){
client = new Client(host, port, true);
client.setReporter("xml", "reports", "Untitled");
}
@Test
public void test01(){
client.setDevice("adb:GT-I9300");
for (int i=0; i<5; i++){
client.openDevice();
client.launch("com.experitest.ExperiBank/.LoginActivity", true, true);
client.elementSendText("default", "Username", 0, "company");
client.elementSendText("default", "Password", 0, "company");
client.click("default", "Login", 0, 1);
client.click("default", "Logout", 0, 1);
client.closeDevice();
}
}
@After
public void tearDown(){
client.generateReport(true);
client.exit();
}
}