mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-27 03:10:08 +08:00
fix: increase the number of reconnection attempts when the UiAutomator connection is disconnected
This commit is contained in:
@@ -584,7 +584,7 @@ func (ud *UIA2Driver) Source(srcOpt ...option.SourceOption) (source string, err
|
||||
}
|
||||
|
||||
func (ud *UIA2Driver) startUIA2Server() error {
|
||||
const maxRetries = 3
|
||||
const maxRetries = 20
|
||||
for attempt := 1; attempt <= maxRetries; attempt++ {
|
||||
log.Info().Str("package", ud.Device.Options.UIA2ServerTestPackageName).
|
||||
Int("attempt", attempt).Msg("start uiautomator server")
|
||||
@@ -594,7 +594,7 @@ func (ud *UIA2Driver) startUIA2Server() error {
|
||||
out, err := ud.Device.RunShellCommand("am", "instrument", "-w",
|
||||
ud.Device.Options.UIA2ServerTestPackageName)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "start uiautomator server failed")
|
||||
log.Error().Err(err).Int("retryCount", maxRetries).Msg("start uiautomator server failed, retrying...")
|
||||
}
|
||||
if strings.Contains(out, "Process crashed") {
|
||||
log.Error().Msg("uiautomator server crashed, retrying...")
|
||||
|
||||
Reference in New Issue
Block a user