2024 Mainstream Technology Appium+IOS Automated Test Environment Construction_ios Automated Test Environment Construction

img img

There are lots of online learning materials, but it is difficult to improve the technology if the knowledge is not systematic and the problem is not studied in depth.

Friends who need this systematic document can get it here

A person can walk quickly, but a group of people can walk farther! Whether you are an old bird in the IT industry or a new person interested in the IT industry, you are welcome to join our circle (technical communication, learning resources, workplace spitting, big factory push, interview and coaching) and let us learn and grow together!

The installation command of the Homebrew is officially provided, but the installation command is not successful due to the problem of the domestic network.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

Through image installation:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" 

(It is recommended to use the mirror source of HKUST)

Carthage

Carthage is used to manage project dependencies, similar to Maven in Java. It is needed later to compile the WebDriverAgent project

brew install carthage
carthage version 

Ios-deploy

Ios-deploy A command-line tool that does not require Xcode to install and debug applications. A valid developer certificate is required and a version above Xcode 7 is required. The terminal enters the command to install:

brew install ios-deploy 

Ideviceinstaller

Ideviceinstaller is a tool that interacts with installation_proxy on iOS devices, allowing you to install, upgrade, uninstall, archive, restore, and list installed or archived app. This tool is used to run tests on real machines and is installed by default.

brew install ideviceinstaller 

Libimobiledevice

Libimobiledevice is a cross-platform software library. Does not rely on any existing private libraries and does not need to break out of jail. This development kit makes it easy for applications to access the device’s file system, get device information, back up and restore devices, manage SpringBoard icons, manage installed apps, get contacts, schedules, notes, bookmarks, and more

#Install the latest versionlibimobiledevice
brew install libimobiledevice --HEAD 

Appium Environment

  1. Node&npm

Node is a javascript runtime environment and npm is the Node Package Manager. We need these because Appium is a node application.

brew install node 

Appium

Appium provides two installation modes: Appium Desktop (desktop version) with graphical interface and Appium Server command line version. Select one of the two manners.

2.1. Appium Desktop

Download Address:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

Note that since the Appium Desktop V1.22.0 version, the Appium Desktop built-in checker, a tool that can be used to obtain page element information, has been removed as a separate program.

picture

The download and installation process is very simple. Here we usually select the new version.

picture

2.Appium Server command line version

Appium server Download management via npm

npm install -g appium 

The latest version is installed by default, and if you need to specify a version, use the following command:

npm install -g appium@1.7.2 

Check appium Version

appium -v 

Start appium Service

# -aparameter:set upappiumworking address
# -pparameter,set upappiumWorking port number
appium -a 127.0.0.1 -p 4723 

picture

Install Appium doctor

Appium doctor can be used to detect whether the dependent environment required by Appium is successful

npm install appium-doctor -g
#DetectioniOSIs the environment installed successfully?
appium-doctor --ios 

picture

The necessary dependcies must be all checked, and some optional dependencies may not be all installed.

Install Appium inspector

As mentioned earlier, the new version Appium Desktop (starting with the V1.22.0 version) has removed the Appium inspector tool, so if we want to use the inspector tool we will need to download an additional Appium inspector:

https://github.com/appium/appium-inspector/releases

picture

After downloading, install the dmg file directly.

Configure Run WebDriverAgent

As we mentioned earlier, WebDriverAgent is the automation engine for testing iOS applications. It is better to use the Appium built-in WebDriverAgent for the new version of Appium and iOS. After the Appium (desktop version or command line version of Appium) is installed, we can use Xcode to compile and run the WebDriverAgent.

For the Appium command line version, WebDriverAgent is in the/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/path

For the Appium desktop version, WebDriverAgent is in the/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent path

Here, take the command line version as an example, click WebDriverAgent.xcodeproj Use Xcode to open the WebDriverAgent project:

picture

Configure WebDriverAgent

The developer account needs to be created for the first configuration.

Select WebDriverAgentLib->Signing&Capabilities, enter apple id and password

picture

Then click Download Manual Profiles and then Manage Certificates

picture

To add a certificate:

picture

Then go back to the Signing&Capabilities of the Xcode tool and select the Team you just added:

picture

You also need to configure the WebDriverAgentRunner, which can be selected in the Team:

picture

Run WebDriverAgent

Select Product->Scheme->WebDriverAgentRunner

picture

Select the device to be tested in Destination. Here I select a iphone8 15.5 simulator. Of course, you can select other devices to be tested.

picture

Finally, click Product->Test. After successful compilation and running, the simulator will be started and a WebDriverAgent application without an icon will be installed in the simulator. After the WebDriverAgent application is started, it will return to the desktop. And you can see the ServerURLHere prompt in the Xcode console log

picture

Enter the http://IP address: Port/status in the middle of the ServerURLHere in the browser. The following prompt indicates that the WebDriverAgent is successfully installed and configured and ready to receive the request.

picture

Preparing the iOS Test app

Many small partners do not have the app test package of ios available at the learning stage. Here we can use the demo project of ios-uicatalog provided by appium.

https://github.com/appium/ios-uicatalog

The demo project contains examples of operations, such as sliding, webview elements, input, click operations, which we can use to practice iOS automation

img img img

There are not only basic materials for Xiao Bai’s learning, but also advanced courses for partners with more than 3 years of experience, covering more than 95% of software testing knowledge points.

As there are a lot of files, only some catalogues are screenshot here. The whole set includes large-scale scriptures, learning notes, source handouts, actual projects, outline routes, and explanation videos, and will be continuously updated later.

Friends who need this systematic document can get it here

29855)] [Overchain Picture Rollback… Img-s6sRMbpY -1714969829856] [picture transfer in the outer chain… (Img-L0BIugok -1714969829856)]

There are not only basic materials for Xiao Bai’s learning, but also advanced courses for partners with more than 3 years of experience, covering more than 95% of software testing knowledge points.

As there are a lot of files, only some catalogues are screenshot here. The whole set includes large-scale scriptures, learning notes, source handouts, actual projects, outline routes, and explanation videos, and will be continuously updated later.

Friends who need this systematic document can get it here

This document is transferred from https://blog.csdn.net/2401_84140754/article/details/138490596,If there is any infringement,Please contact to delete。