Make writing a habit together! This is the third day of my participation in the “Gold Digging Day New Plan · April More text Challenge”. Click here for more details.
Recently, Appium, a mobile automation testing framework, has launched a new project, Appium 2.0. The transition to basic functionality is underway and several beta versions have been released. On GitHub, you can see all the plans for the project in the near future. Most of the original features have been completed, and some less critical configuration and documentation work is in progress.
New capabilities in Appium 2.0
I’m personally a big fan of Appium 2.0, and while frameworks like AirTest are currently working well, the new cross-platform testing ecosystem that Appium 2.0 is trying to create is very attractive. The big things Appium hopes to do in 2.0 are:
- Unbind all drivers. Appium 1.0 is bound to the system, for example, Android is bound to Uiautomator2 and iOS is bound to Xcuitest. Other test drivers are more difficult to install. After untying drivers, Appium 2.0 can easily add the required driver from the command line.
- Create a perfect drivers ecosystem. Appium 1.0 has cross-platform testing capabilities. Drivers for iOS, Android, Windows, Mac, and Flutter are available, but some drivers are still not being used. Appium 2.0 allows everyone to modify and customize based on existing drivers, or even create a completely new driver for testing. It’s very easy to integrate Appium with one line of command.
- Create a complete plug-in system. Nowadays, mobile terminal test scenarios are changeable and complex. For the test means of special scenarios, plug-ins with special functions are often required. The typical one is the positioning and diff mechanism based on graphic recognition. As more and more developers get involved and develop plugins with various functions, Appium’s development will be promoted very quickly.
Precautions for Installing Appium 2.0
I spent a couple of minutes experimenting with the simple running process and, except for a few pits, the upgrade process was smooth.
Step 1: Install Node.js
Appium 2.x has not been officially released yet, so there is no official interface download. To try out the new features of Appium 2.0, you can only install them through Node. Visit node.org to download the Node environment, click Install, and set environment variables during installation.
image-20211220142638123
Step 2: Upgrade the Appium service
There are two options to upgrade Appium service. The first one is global installation, which can easily operate Appium commands in any directory of the system. However, I am mainly using Appium 1.x and do not want to use Appium 2.0 as the main force, so I give up this method for now.
Global installation:
npm install -g appium@next
Copy the code
The second method is local installation, less invasive, Appium will be installed to a specified directory, into the directory to run the Appium command, more suitable for multiple version management. Create a local directory appium_server, go to the directory and run:
npm install appium@next
Copy the code
The local appium service can be started by running the appium command in node_modules directory, or by using NPX:
Node_modules \.bin\appium # or NPX appiumCopy the code
After the server is started, the default port 4723 will be prompted to start the service. Since 2.0 has unbundled drivers and plug-ins as an independent system, No drivers and No Plugins will be prompted after the server is started:
C:\Desktop\appium_server>node_modules\.bin\appium
[Appium] Welcome to Appium v2.0.0-beta.23 (REV HEAD)
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[Appium] No drivers have been installed. Use the "appium driver" command to install the one(s) you want to use.
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
Copy the code
Step 3: Install the test driver
Appium 2 test drivers are managed separately. By default, no test drivers are installed. All drivers are managed through the Appium driver subcommand. There are also many officially available drivers.
Now I only install the usual Android driver UIAutomator2 and iOS driver xcuitest:
appium driver install uiautomator2
appium driver install xcuitest
Copy the code
Step 4: Start the test script
from appium.webdriver import Remote caps = { "platformName": "Android", "deviceName": "Android Emulator", "automationName": "UiAutomator2", "app": File} driver = Remote(desired_capabilities=caps, command_executor = '<http://127.0.0.1:4723>')Copy the code
Start an app using a Python program. The Python library is appium-python-client. Install the latest version. It is important to note 2.0 interface prefix is no longer a http://127.0.0.1:4723/wd/hub, / wd/hub has been removed, direct access to the IP: port number, if still use the default address before, will be prompted to find routing.
[debug] [HTTP] No route found for /wd/hub/session [HTTP] <-- POST /wd/hub/session 404 10 ms - 211
Copy the code
conclusion
Appium2.0 will be released soon, so get a taste of the new features ahead of time.
I am nine handle, thank you for your patience to read, see you next time.