Appium Automated Testing Framework--automated start-up of multiple equipment thinking carding

Source: Internet
Author: User
Tags appium

Today, let's talk about it. If the automation implementation runs the script on more than one device.

First, we recall how to run a Python script on a single device, generally divided into three steps

1. Start Appium Service

2. Create a Driver

3. Run the Python script

Similarly, running more than one device is basically the three steps

1. Start multiple Appium services (by setting up different ports and associating devices)

2. Create the driver and ensure the port number and device association, and consistent with step 1

3, multi-threaded or multi-process run script.

Ii. decomposition of steps

Let's look at how these three steps are implemented in each of these

1. Start multiple Appium services, "Appium-p appium_port -bp bootstrap_port -u devicename --no-reset --session-override "

Need to solve the following problems

1) How to run DOS commands in Python

2) How to get the device

3) How to create an available port (non-occupied)

2, create the driver, the difficulty is that the drive needs to be created and the services in step 1 to correlate to ensure that the port, device, driver one by one corresponds

Solution Ideas

1) The variables (appium_port, bootstrap_port , and devicename) are written to the file at the same time as the command is generated by step 1, which can be the init file, Yaml file or other)

2) When creating the driver, read the port and device name from the file,

3. Multi-threaded or multi-process run scripts

Practice finds that using multithreading to run Python scripts, under the latest Appium service, can sometimes cause confusion, in order to avoid this problem, we use multiple processes here.

Iii. Summary of Ideas

1. Execute dos in Python, get device information, create an available port

2. Execute DOS command to start multiple Appium services

3. Write the Boot information (ports and devices) to the Yaml file

4. Read the port number and device information from the Yaml file and create the corresponding driver

5, introduce multi-process, run the script

Appium Automated Testing Framework--automated start-up of multiple equipment thinking carding

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.