save time by requiring parallel testing of multiple models in real-world applicationsThe idea of multi-machine testingstart multiple Appium servers interacting with multiple machines (both Android and iOS) Note: Be sure to use node to install the Appium command line and use the Appium command to start multiple servicesSpecify the server port number when you start the command, and the port numbers that interact with the client The following commands are started in the background, using the background startup mode of the Mac [Nohup command &], if the Windows machine uses the [start/b command]Android Multi-machine server Start command
Startservercmd ="nohup appium--session-override-a"+ Address +"- P"+appium_port +"-BP"+Bootstrap_port+"--selendroid-port"+selendroid_port+"--chromedriver-port"+chromedriver_port+"- u"+deviceid+" "+"--no-reset &"
Description:Address: Start server addresses, if not specified as 0.0.0.0Appium_port: Port number of the server that is started, default 4723Bootstrap_port: The port number that interacts with the higher version (4.2 and above) of the Android machine, the default 3724Selendroid_port: The port number that interacts with the lower version (below 4.2) of the Android machine, the default 8080Chromedriver_port: Port number to interact with Chrome browser, default 9516DeviceID: ID of the device (ADB devices view) Note: The Android multi-machine boot server must specify the-u parameter, otherwise it will be thrown wrong when running on Windows Server startup commands for iOS multi-machine
"""" +appium_port+" --webdriveragent-port" +webdriveragent_port
Description:Address: Start server addresses, if not specified as 0.0.0.0Appium_port: Port number of the server that is startedWebdriveragent_port: The port number of the webdriveragent that interacts with the iOS client, the default 8010multi-process Start server command, client connectionMulti- machine testing with multiple processesdefines an incremental increment, in which each process increments this increment on the base port number, guaranteeing that the port number of each server does not conflict The following is a multi-process code, devices is the DeviceID list for the connected phone, Testsuit () is the case entry to be executed
if __name__=="__main__": ifdevices = =[]: Log (). log ("Insert your phone first and then test it. Currently required mobile phone system:"+Optionsystem) sys.exit ()ifLen (Devices) = = 1: Testsuit ()Else: fromMultiprocessingImportProcess port_d=1#the difference between each port number forDeviceIDinchDevices:t=process (Target=testsuit, args=(Port_d,)) T.start () Port_d=port_d+1
Note: Port_d is the fixed increment above, through which we can add to the base port number (the base port number to write to a common variable, such as Appium server with 4723) When you start the server, you can connect to the server by using a different Appium server port number.
Webdriver. Remote ('http://127.0.0.1:'+appiumport+'/wd/hub', desired_ Caps
Note: Starting a multi-process in Windows must write a multi-process connection to the "if __name__ = =" __main__ ":" Below, otherwise the webdriver will be rejected if the connection is initiated
Appium Multi-machine parallel test