This article mainly explains App Startup steps and initialization operations of automatic test, etc , In addition, there is a portal for a series of articles below , It's still being updated , Interested partners can also go to check , Don't talk much , Let's have a look ~
Series articles :
Series articles 1:【Python automated testing 1】 meet Python The beauty of the
Series articles 2:【Python automated testing 2】Python Installation configuration and PyCharm Basic use
Series articles 3:【Python automated testing 3】 First knowledge of data types and basic syntax
Series articles 4:【Python automated testing 4】 Summary of string knowledge
Series articles 5:【Python automated testing 5】 List and tuple knowledge summary
Series articles 6:【Python automated testing 6】 Dictionary and collective knowledge summary
Series articles 7:【Python automated testing 7】 Data operator knowledge collection
Series articles 8:【Python automated testing 8】 Explanation of process control statement
Series articles 9:【Python automated testing 9】 Function knowledge collection
Series articles 10:【Python automated testing 10】 File basic operation
Series articles 11:【Python automated testing 11】 modular 、 Package and path knowledge collection
Series articles 12:【Python automated testing 12】 Knowledge collection of exception handling mechanism
Series articles 13:【Python automated testing 13】 class 、 object 、 Collection of attribute and method knowledge
Series articles 14:【Python automated testing 14】Python Basic and advanced exercises of automatic test
Series articles 15:【Python automated testing 15】unittest The core concept and function of test framework
Series articles 16:【Python automated testing 16】 Test case data separation
Series articles 17:【Python automated testing 17】openpyxl Secondary packaging and data driven
Series articles 18:【Python automated testing 18】 Configuration file analysis and practical application
Series articles 19:【Python automated testing 19】 Log system logging Explain
Series articles 20:【Python automated testing 20】 Construction of interface automation test framework model
Series articles 21:【Python automated testing 21】 Interface automation test practice 1 _ Interface concept 、 Project introduction and test process Q & A
Series articles 22:【Python automated testing 22】 Interface automation test practice II _ Interface framework modification and use case optimization
Series articles 23:【Python automated testing 23】 Interface automation test practice III _ Dynamic parameterization and data forgery
Series articles 24:【Python automated testing 24】 Interface automation test practice IV _Python Operating the database
Series articles 25:【Python automated testing 25】 Interface automation test practice 5 _ Database assertion 、 Interface Association and related management optimization
Series articles 26:【Python automated testing 26】 Interface automation test practice 6 _pytest frame +allure Explain
Series articles 27:【Python automated testing 27】Web Automated testing theory 、 Environment construction and common operations
Series articles 28:【Python automated testing 28】html Basic grammar
Series articles 29:【Python automated testing 29】Xpath、 Axis operation and CSS Detailed explanation of element positioning
Series articles 30:【Python automated testing 30】Web The three waiting and switching of automation
Series articles 31:【Python automated testing 31】Web Automatic mouse and keyboard operation 、select usage
Series articles 32:【Python automated testing 32】App Automation environment construction
The author explains Appium The start-up steps are mainly to prevent some novices from making mistakes in the process of using , Operate as follows , Can ensure a smooth start :
(1) First step : Turn on the real machine or Simulator , Let's start with the real machine :
Real machine : Regardless of the mobile system , Need to open developer mode , Android mobile phone enters the corresponding mobile phone information interface and can be opened by clicking the version several times , Some mobile phones will be different ,IOS The mobile phone needs to apply for a developer account before opening the developer mode , The specific operation can be viewed by Baidu , After opening the developer mode, you need to open USB Debug mode , After the phone is connected to the computer , Related permission requests , All authorized
Simulator : If it is a lightning simulator, no operation is required , If it's a non lightning Simulator , For example, night God 、MuMu, Additional configuration is needed
The goal is : We need to Android Self contained adb Replace the executable file with the one provided by the simulator adb Executable file
Purpose : Prevent the of the system adb Environment and simulator adb The environment is inconsistent , Cause problems such as compatibility errors in the environment
operation :
(1) Find the of the system adb.exe
(2) A copy of , Rename it to nox_adb.exe
(3)nox_adb.exe Overlay Simulator bin In the catalog nox_adb.exe
The simulator may not be able to find , We need to pass adb Command to connect , for instance :
Night God Simulator :adb connect 127.0.0.1:62001
Free Simulator :adb connect 127.0.0.1:21503
After the simulator is successfully connected , You can make simple settings , Like the screen 、usb Debug mode
(2) The second step : Check whether the simulator or real machine is successfully connected :
We go through adb Command to check whether the connection is successful :adb devices
(3) The third step : Open... After confirming that it is connected Appium service , The port number is 4723 / 4444, Ensure that the service is not controlled and occupied
(4) Step four : Start a App( Software under test )
Before starting a software under test , We need to initialize first , The operation steps are as follows :
(1) First step : The connection port needs to be specified ,4723 / 4444
The reason for specifying the port is that the default port may be occupied , Or start multiple Appium service
(2) The second step : You need to specify which mobile device is connected
If there are many mobile phones connected to the computer , It needs to be explained which mobile phone it is , In the case of multiple phones , You need to specify the
(3) The third step : You need to specify the corresponding system
The connected mobile phone needs to be specified as Android System or IOS System , For services , There will be unique processing methods and operations for different systems
(4) Step four : Specifies the of the operation App Which one is
App quite a lot , Specify corresponding App( Software under test )
# Import connected classes
from appium.webdriver import Remote
def test_start_appium():
#caps Store the initialization information that needs to be connected
caps = {
# Equipment name
"deviceName": "emulator-5554",
# Operating system name
"platformName": "Android",
# Selected App route , In the case of Intranet , Specify the corresponding Apk file location
"app": r"D:\data\xxx\xxx"
}
""" Python The default port provided is 4444, If not 4444 If necessary, you need to specify the port manually , Otherwise, you can't connect If your service port is 4444, Then you can ignore command_executor The setting and filling of """
driver = Remote(command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities=caps)
In the previous article, the author did not introduce Appium Some framework advantages of , Here's a list of , Follow up :
(1) Support for multiple platforms : Both Android and IOS, And support Windows、Mac as well as Web Automated testing , Cross platform is very powerful ,ios Of xcuitest、Android Of uiautomator2、Espresso etc. , stay appium There's integration in
(2) Native and hybrid applications : Content supporting Android independent component development ,H5 And so on
(3) Support mainstream programming languages :Java / Python / Js
(4) free 、 Open source
(5) There are many learning materials , In addition to network resources , There are also official documents and support Chinese
In addition, there are some design philosophies , These design philosophies can be adopted by Appium On the official website of
For example, the comparison of versions , The details are as follows :
(1)Python Run to Appium service /session An... Was sent in the interface post request , Set up a session object , The parameter is caps The specified parameter object
(2)Appium It will verify the transmitted parameters , For example, version information , Check by adb Instructions ,adb shell Enter the system , Get information about the system , Complete the verification
(3) Then there will be App Installation inspection of , After the inspection is finished , adopt adb shell am start start-up app
It should be noted that there are many verification operations ,Appium Start up may be slow
All right. ~ The above is all the content shared in this article , Have you learned ? I hope I can help you !