mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 22:44:05 +08:00
refactor: results dir
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
@@ -188,7 +187,7 @@ type TCaseConverter struct {
|
||||
func (c *TCaseConverter) genOutputPath(suffix string) string {
|
||||
var outFileFullName string
|
||||
if curlCmd := strings.TrimSpace(c.InputSample); strings.HasPrefix(curlCmd, "curl ") {
|
||||
outFileFullName = fmt.Sprintf("curl_%v_test%v", time.Now().Format("20060102150405"), suffix)
|
||||
outFileFullName = fmt.Sprintf("curl_%v_test%v", env.StartTimeStr, suffix)
|
||||
if c.OutputDir != "" {
|
||||
return filepath.Join(c.OutputDir, outFileFullName)
|
||||
} else {
|
||||
|
||||
@@ -208,7 +208,6 @@ type DriverExt struct {
|
||||
doneMjpegStream chan bool
|
||||
scale float64
|
||||
ocrService OCRService // used to get text from image
|
||||
StartTime time.Time // used to associate screenshots name
|
||||
ScreenShots []string // save screenshots path
|
||||
|
||||
CVArgs
|
||||
@@ -657,8 +656,8 @@ func (dExt *DriverExt) DoAction(action MobileAction) error {
|
||||
case CtlScreenShot:
|
||||
// take snapshot
|
||||
log.Info().Msg("take snapshot for current screen")
|
||||
screenshotPath, err := dExt.ScreenShot(fmt.Sprintf("%d_screenshot_%d",
|
||||
dExt.StartTime.Unix(), time.Now().Unix()))
|
||||
screenshotPath, err := dExt.ScreenShot(fmt.Sprintf("screenshot_%d",
|
||||
time.Now().Unix()))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "take screenshot failed")
|
||||
}
|
||||
|
||||
@@ -349,9 +349,7 @@ func (dev *IOSDevice) StartPerf() error {
|
||||
return err
|
||||
}
|
||||
|
||||
dev.perfFile = filepath.Join(env.ResultsPath,
|
||||
fmt.Sprintf("perf_%s.log", time.Now().Format("20060102150405")))
|
||||
|
||||
dev.perfFile = filepath.Join(env.ResultsPath, "perf.data")
|
||||
log.Info().Str("perfFile", dev.perfFile).Msg("create perf file")
|
||||
file, err := os.OpenFile(dev.perfFile,
|
||||
os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0o755)
|
||||
@@ -395,9 +393,7 @@ func (dev *IOSDevice) StartPcap() error {
|
||||
return err
|
||||
}
|
||||
|
||||
dev.pcapFile = filepath.Join(env.ResultsPath,
|
||||
fmt.Sprintf("dump_%s.pcap", time.Now().Format("20060102150405")))
|
||||
|
||||
dev.pcapFile = filepath.Join(env.ResultsPath, "dump.pcap")
|
||||
log.Info().Str("pcapFile", dev.pcapFile).Msg("create pcap file")
|
||||
file, err := os.OpenFile(dev.pcapFile,
|
||||
os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0o755)
|
||||
|
||||
Reference in New Issue
Block a user