Close or KIll Android emulator after tests have ran?

561 views
Skip to first unread message

Mario

unread,
May 15, 2014, 1:31:14 PM5/15/14
to appium-...@googlegroups.com
Using Appium 1.0 via command line on Windows 7 along with AVD API 19. Visual Studio with C# and NUnit as test runner

Comand line:
appium --avd Android_4.4.2_avd1

C# capabilities:
// Setup dummy capabilities to launch the Calculator app (this is only to use Appium to autolaunch the AVD before running tests on the stock browser--this will be fixed and not needed in next release of 1.0+)
DesiredCapabilities dummyCaps = new DesiredCapabilities();
dummyCaps.SetCapability("platformName", "Android");
dummyCaps.SetCapability("platformVersion", "4.4");
dummyCaps.SetCapability("deviceName", "Android Emulator");
dummyCaps.SetCapability("app", "Calculator.apk");
dummyCaps.SetCapability("appPackage", "com.android.calculator2");
dummyCaps.SetCapability("appActivity", "Calculator");
Driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), dummyCaps);
Driver.Quit(); // Kill the Driver connection established with the Calculator app

// Setup capabilities for launching the Android native Browser app
DesiredCapabilities appiumStockAndroidCapabilities = new DesiredCapabilities();
appiumStockAndroidCapabilities.SetCapability("platformName", "Android");
appiumStockAndroidCapabilities.SetCapability("platformVersion", "4.4");
appiumStockAndroidCapabilities.SetCapability("deviceName", "Android Emulator");
appiumStockAndroidCapabilities.SetCapability("browserName", "Browser");
Driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), appiumStockAndroidCapabilities);

// Teardown has code of
Driver.Quit();


I'm wondering if there is a way to have Appium close the Android emulator after the test suite has ran and completed their execution. Ideally I would like a fresh Android emulator to start upon kicking off a test and then close the emulator after the test has concluded.

I could always go down the route of killing emulator.exe processes at the conclusion of the test Teardown but I would prefer it if Appium could provide this functionality as I believe I've seen this implemented in the iPhone simulator on a Mac.


Thanks!
Reply all
Reply to author
Forward
0 new messages