MCPcopy Index your code
hub / github.com/httprunner/httprunner / NewAndroidDevice

Function NewAndroidDevice

hrp/pkg/uixt/android_device.go:83–104  ·  view source on GitHub ↗

uiautomator2 server must be started before adb shell am instrument -w io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner

(options ...AndroidDeviceOption)

Source from the content-addressed store, hash-verified

81// uiautomator2 server must be started before
82// adb shell am instrument -w io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner
83func NewAndroidDevice(options ...AndroidDeviceOption) (device *AndroidDevice, err error) {
84 device = &AndroidDevice{
85 UIA2IP: UIA2ServerHost,
86 UIA2Port: UIA2ServerPort,
87 }
88 for _, option := range options {
89 option(device)
90 }
91
92 deviceList, err := GetAndroidDevices(device.SerialNumber)
93 if err != nil {
94 return nil, err
95 }
96
97 dev := deviceList[0]
98 device.SerialNumber = dev.Serial()
99 device.d = dev
100 device.logcat = NewAdbLogcat(device.SerialNumber)
101
102 log.Info().Str("serial", device.SerialNumber).Msg("select android device")
103 return device, nil
104}
105
106func GetAndroidDevices(serial ...string) (devices []*gadb.Device, err error) {
107 var adbClient gadb.Client

Callers 8

parseConfigMethod · 0.92
initUIClientMethod · 0.92
initAndroidDeviceFunction · 0.92
TestTapUIWithScreenshotFunction · 0.85
setupAndroidFunction · 0.85
TestDriver_AppLaunchFunction · 0.85
TestDriver_KeepAliveFunction · 0.85
TestDriver_AppTerminateFunction · 0.85

Calls 3

GetAndroidDevicesFunction · 0.85
NewAdbLogcatFunction · 0.85
SerialMethod · 0.45

Tested by 5

TestTapUIWithScreenshotFunction · 0.68
setupAndroidFunction · 0.68
TestDriver_AppLaunchFunction · 0.68
TestDriver_KeepAliveFunction · 0.68
TestDriver_AppTerminateFunction · 0.68