mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-08 07:51:25 +08:00
Merge 'bugfix/huangbin/action_log' into 'master'
Bugfix/huangbin/action log See merge request: !143
This commit is contained in:
@@ -25,7 +25,7 @@ const (
|
|||||||
CaseFileName = "case.json" // $PWD/results/20060102150405/case.json
|
CaseFileName = "case.json" // $PWD/results/20060102150405/case.json
|
||||||
|
|
||||||
// mobile device path
|
// mobile device path
|
||||||
DeviceActionLogFilePath = "/sdcard/Android/data/io.appium.uiautomator2.server/files/hodor"
|
DeviceActionLogFilePath = "/storage/emulated/0/Download/"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|||||||
@@ -706,17 +706,16 @@ func (ad *ADBDriver) StopCaptureLog() (result interface{}, err error) {
|
|||||||
log.Error().Err(err).Msg("failed to close adb log writer")
|
log.Error().Err(err).Msg("failed to close adb log writer")
|
||||||
}
|
}
|
||||||
pointRes := ConvertPoints(ad.Device.Logcat.logs)
|
pointRes := ConvertPoints(ad.Device.Logcat.logs)
|
||||||
|
|
||||||
// 没有解析到打点日志,走兜底逻辑
|
// 没有解析到打点日志,走兜底逻辑
|
||||||
if len(pointRes) == 0 {
|
if len(pointRes) == 0 {
|
||||||
log.Info().Msg("action log is null, use action file >>>")
|
log.Info().Msg("action log is null, use action file >>>")
|
||||||
actionLogDirPath := config.GetConfig().ActionLogDirPath()
|
actionLogDirPath := config.GetConfig().ActionLogDirPath()
|
||||||
logFilePathPrefix := fmt.Sprintf("%v/data", actionLogDirPath)
|
|
||||||
files := []string{}
|
files := []string{}
|
||||||
ad.Device.RunShellCommand("pull", config.DeviceActionLogFilePath, actionLogDirPath)
|
actionLogRegStr := `.*data_\d+\.txt`
|
||||||
|
ad.Device.PullFolder(config.DeviceActionLogFilePath, actionLogDirPath)
|
||||||
err = filepath.Walk(actionLogDirPath, func(path string, info fs.FileInfo, err error) error {
|
err = filepath.Walk(actionLogDirPath, func(path string, info fs.FileInfo, err error) error {
|
||||||
// 只是需要日志文件
|
// 只是需要日志文件
|
||||||
if ok := strings.Contains(path, logFilePathPrefix); ok {
|
if ok, _ := regexp.MatchString(actionLogRegStr, path); ok {
|
||||||
files = append(files, path)
|
files = append(files, path)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user