"Turn 2" Appium 1.6.3 in Xcode 8 (real machine) test environment Construction Experience Summary

Source: Internet
Author: User
Tags appium testng

Appium 1.6.3 Experience in Xcode 8 (real machine) test environment construction

About Appium 1.6.3 in Xcode 8, 1 real-world environment build problem more, write this article, for your reference, so that everyone less detours.

before starting the iOS real -world test, be sure to set up the environment for Appium 1.6.3 + Xcode 8 on the iOS simulator, see my previous post: Appium 1.6.3 in Xcode 8, iOS 10.2 (simulator) test environment Experience Summary

If the environment on the iOS simulator is OK, then build it on the real machine, or you should give up.

Go to the Chase:

First of all, above article: Appium 1.6.3 in Xcode 8, IOS 10.2 (simulator) test Environment Building Experience Summary The first, second, third step must end , and then start, be sure!

First, the installation of related dependencies

(1) Installation Ios-deploy

NPM i-g Ios-deploy

Failure to do so will cause an error:

[Xcuitest] Could not initialize Ios-deploy Make sure it's installed and works on your system

[Xcuitest] Error:could not initialize Ios-deploy Make sure it's installed and works on your system

At xcuitestdriver.getideviceobj$ (.. /.. /LIB/DRIVER.JS:685:13)

(2) Installation Libimobiledevice

Brew Install Libimobiledevice--head

Second, install appium-xcuitest-driver (uninstall first reinstall new version 2.5.3)

Cause: Appium default installation of the Appium-xcuitest-driver version is a bit old, seemingly 2.4.0 version, the old version of the problem, run the test will prompt

Debug] [webdriveragent] Device:mar 15:29:21 cheersde-iphone xctrunner[2848] <notice>: Running tests ...

[Debug] [Webdriveragent] Device:mar 15:29:22 Cheersde-iphone xctrunner[2848] <notice>: Continuing to run tests in the background with TAS K ID 1

[Debug] [Xcuitest] Waiting for Webdriveragent server to finish loading ...

The app launch that led to the test  not up , has been stuck in [debug][xcuitest] waiting for webdriveragent server to finish loading ... This piece

The new version, Appium-xcuitest-driver 2.5.3, solves this problem.

Installation method:

Cd/usr/local/lib/node_modules/appium

NPM Uninstall Appium-xcuitest-driver Uninstall first

NPM install [email protected] Reinstall 2.5.3

third, compile the Webdriveragentrunner, and install to the real machine (my iphone 5s)

Description:appium is on the phone webdriveragentrunner, to run the test, no this on the real machine no way to test (simulator needs a, but will automatically install)

3.1 Open webdriveragent with Xcode and compile (requires some setup before compiling)

(1) Enter the Webdriveragent folder, you can use the following methods

Directory is/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/webdriveragent

(2) Select the Webdriveragent.xcodeproj file, open with Xcode, and do the settings.

See figure

compile Webdriveragent Click the Compile button , see. Tip Build Success after compilation is complete.

3.2 Install webdriveragent on your phone (both the phone and Mac are in the same network segment)

(1) Connecting mobile phones and Mac computers

(2) terminal enters Webdriveragent folder

Cd/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/webdriveragent

Perform:

Xcodebuild-project webdriveragent.xcodeproj-scheme webdriveragentrunner-destination ' id= real machine udid ' test

At this point, the Webdriveragentrunner app will be installed on your phone.

Please note that if the prompt is a trusted developer, please trust your Apple ID in Settings-general-device management (profile).

Run again

Xcodebuild-project webdriveragent.xcodeproj-scheme webdriveragentrunner-destination ' id= real machine udid ' test

So the Webdriveragentrunner on the phone installed successfully.

Iv. Start Appium

Command line Execution Appium

Five, write a simple test case, Java writing (based on testng):

[Java]View PlainCopy
  1. <span style="Font-family:simsun;"  > Packagecom.cheers.qa;
  2. Import Io.appium.java_client.ios.IOSDriver;
  3. Import Io.appium.java_client.remote.MobileCapabilityType;
  4. Import Org.openqa.selenium.By;
  5. Import org.openqa.selenium.WebElement;
  6. Import org.openqa.selenium.remote.DesiredCapabilities;
  7. Import Org.testng.annotations.Test;
  8. Import java.net.MalformedURLException;
  9. Import Java.net.URL;
  10. Import Java.util.concurrent.TimeUnit;
  11. Public class Cheers_tc1 {
  12. private Iosdriver WD;
  13. Public CHEERS_TC1 () {}
  14. @Test
  15. public void Test1 () throws interruptedexception{
  16. Desiredcapabilities capabilities = new Desiredcapabilities ();
  17. Capabilities.setcapability ("appium-version", "1.6.3");
  18. Capabilities.setcapability ("PlatformName", "IOS");
  19. Capabilities.setcapability ("platformversion", "10.2.1");
  20. Capabilities.setcapability ("devicename", "IPhone 5s");
  21. Capabilities.setcapability (Mobilecapabilitytype.automation_name, "xcuitest");
  22. Capabilities.setcapability (Mobilecapabilitytype.app, "/users/***/documents/workspace/swiftlive_ios_appium/  Ipa_files/swiftlive.ipa ");
  23. Capabilities.setcapability (Mobilecapabilitytype.udid, "iphone real Machine UDID");
  24. try {
  25. WD =New Iosdriver (new URL ("Http://127.0.0.1:4723/wd/hub"), capabilities);
  26. } catch (Malformedurlexception e) {
  27. E.printstacktrace ();
  28. }
  29. Wd.manage (). Timeouts (). implicitlywait (timeunit.seconds);
  30. System.out.println ("******************** Cheers Appium iOS true machine Test **************************");
  31. Wd.close ();
  32. }
  33. }</span>

Then right-click Run as testng to see the effect on the real machine

Reference article:
https://testerhome.com/topics/6962

2 Appium 1.6.3 experience in Xcode 8 (real machine) test environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.