mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-07 08:02:42 +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
|
||||
|
||||
// mobile device path
|
||||
DeviceActionLogFilePath = "/sdcard/Android/data/io.appium.uiautomator2.server/files/hodor"
|
||||
DeviceActionLogFilePath = "/storage/emulated/0/Download/"
|
||||
)
|
||||
|
||||
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")
|
||||
}
|
||||
pointRes := ConvertPoints(ad.Device.Logcat.logs)
|
||||
|
||||
// 没有解析到打点日志,走兜底逻辑
|
||||
if len(pointRes) == 0 {
|
||||
log.Info().Msg("action log is null, use action file >>>")
|
||||
actionLogDirPath := config.GetConfig().ActionLogDirPath()
|
||||
logFilePathPrefix := fmt.Sprintf("%v/data", actionLogDirPath)
|
||||
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 {
|
||||
// 只是需要日志文件
|
||||
if ok := strings.Contains(path, logFilePathPrefix); ok {
|
||||
if ok, _ := regexp.MatchString(actionLogRegStr, path); ok {
|
||||
files = append(files, path)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user