Turn from:http://m.blog.csdn.net/blog/kittyboy0001/40893979Appium
Appium is an open-source, automated test platform for native or hybrid mobile applications (hybrid mobile apps) that can quickly create functional automated test cases for iOS and Android mobile platforms. Compared to other mobile automation testing tools, the Appium test has been called by Selenium's client library to make it available in any language, including Python, Ruby, Node.js,objective,java, and so on.
Official address: http://appium.io/
1 System requirements for iOS
Mac OSX 10.7+
XCode 4.5+ W/command Line Tools
Android
Mac OSX 10.7+ or Windows 7+ or Linux
Android sdk≥16 (SDK < selendroid mode)
2 The bottom of the Appium
Ios:apple ' s UIAutomation
Android 4.2+: Google ' s Uiautomator
Android 2.3+: Google ' s instrumentation
3 Android Real Machine run
Import Java.net.malformedurlexception;import java.net.url;import Org.junit.after;import Org.junit.Before;import Org.openqa.selenium.remote.capabilitytype;import Org.openqa.selenium.remote.desiredcapabilities;import Com.tmall.app.search.monkey.page.tmguideactivitypage;import io.appium.java_client. Appiumdriver;public class Basetest {protected Appiumdriver driver; Open the app and do some initialization work. such as access to the target page, etc.. @Before public void SetUp () throws Exception {setupdriver (); Tmguideactivitypage page = new Tmguideactivitypage (driver); if (Page.isready ()) {//Page.splash (); }} @After public void TearDown () throws Exception {driver.quit (); }//Start appium Driver public void Setupdriver () throws malformedurlexception{//final File appdir = new F Ile ("D:\\tmapp"); Final file App = new file (appdir, "10002119.apk"); Final desiredcapabilities capabilities = new Desiredcapabilities (); CapabiLities.setcapability (Capabilitytype.browser_name, ""); Capabilities.setcapability ("DeviceName", "Android"); Capabilities.setcapability ("platformversion", "4.3"); Capabilities.setcapability ("PlatformName", "Android"); Capabilities.setcapability ("App", App.getabsolutepath ()); Capabilities.setcapability ("Apppackage", "com.tmall.wireless"); Capabilities.setcapability ("appactivity",//". Module.main.TMMainTabActivity"); ". Module.launchalert.TMLaunchAlertActivity"); Capabilities.setcapability ("Appwaitactivity", ". module.main.TMMainTabActivity"); Capabilities.setcapability ("Newcommandtimeout", 120); Driver = new Appiumdriver (New URL ("Http://127.0.0.1:4723/wd/hub"), capabilities); }}public class Detailtest extends basetest{@Test public void Mydetailtest () {Search s = new Search (); S.doaction (driver); ASSERT (xxxxx);}
}
4 parameter settings
The desiredcapabilities is responsible for setting the parameters when the server is started. Actual use, according to their own needs, you can modify some of the parameters.
For example, when an application looks for an element of a page, it may take longer to locate. The default command interval is 60s, and will automatically exit if it is not found within 60s. You can use a newCommandTimeout value that is set to a larger size.
capabilities.setCapability("newCommandTimeout",240);
For example, when you first use Appium, set the path of the installation apk above, and the debugger discovers that the interface has no return data after installation. The problem was later fixed because it was re-signed at the time of installation. The protection mechanism of the program makes no data return. You can use noSign settings to avoid re-signing.
capabilities.setCapability("noSign","true");
Of course, later found not to write the file path in the program, but to install the test package in advance, so as to avoid the need to reinstall each time.
Full Server parameters
Http://appium.io/slate/en/master/?ruby#appium-server-capabilities
**server capabilities**capability Appium, selendroidplatformname platform name: IOS, Android, or firefoxosplatfor Mversion Mobile Device System version number, 7.1, 4.4deviceName ios:instruments-s devices,android: Write the App installation file path:/A bs/path/to/my.apk or Http://myapp.com/app.ipabrowserName test Web browser, if the app is measured ignore newcommandtimeout wait for the maximum time of the new command, time-out back Out The default is whether 60sautoLaunch is automatically installed and started, the default Truelanguage simulator language setting locale simulator regional Settings Udid Device number Orientation Simulator's screen settings Autowebview Move directly into Webview contextnoreset not heavy before current session App Status Fullreset iOS Delete folder, Android Delete app data. **android only**appactivity to start the activityapppackage to start the package appwaitactivity wait for AC Tivityappwaitpackage waiting packet devicereadytimeout time to wait for device readiness Androidcoverage Enableperformancel Ogging (Chrome and WebView only) Default=falseandroiddevicereadytimeoutandroiddevicesocketaVdavdlaunchtimeoutavdreadytimeoutavdargsusekeystorekeystorepathkeystorepasswordkeyaliaskeypasswordchromedriverexecutablea Utowebviewtimeoutintentactionintentcategoryintentflagsoptionalintentargumentsunicodekeyboardresetkeyboardnosign Skip checking and signing,work only with uiautomator and not with Selendroidignoreunimportantviews**ios onl y** Calendarformatbundleidudidlaunchtimeoutlocationservicesenabledlocationservicesauthorizedautoacceptalertsnativeinstruments Libnativewebtapsafariallowpopupssafariignorefraudwarningsafariopenlinksinbackgroundkeepkeychainslocalizablestringsdirproc Essargumentsinterkeydelayshowioslog
Appium Server Parameters