From f73444b33e21199cc8b246182610c74a09900b4d Mon Sep 17 00:00:00 2001 From: vearne Date: Thu, 6 Jun 2024 10:24:28 +0800 Subject: [PATCH] fix report bug --- internal/command/http_automate.go | 2 -- internal/util/util.go | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/command/http_automate.go b/internal/command/http_automate.go index 34526ee..da2916f 100644 --- a/internal/command/http_automate.go +++ b/internal/command/http_automate.go @@ -2,7 +2,6 @@ package command import ( "context" - "fmt" "github.com/lianggaoqiang/progress" "github.com/vearne/autotest/internal/config" "github.com/vearne/autotest/internal/model" @@ -72,7 +71,6 @@ func GenReportFileHttp(testCasefilePath string, tcResultList []HttpTestCaseResul }) var records [][]string records = append(records, []string{"id", "desc", "state", "reason"}) - fmt.Println("-------", len(tcResultList)) for _, item := range tcResultList { reasonStr := item.Reason.String() if item.Reason == model.ReasonSuccess { diff --git a/internal/util/util.go b/internal/util/util.go index 4be9ae8..0b244d4 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -7,7 +7,7 @@ import ( ) func WriterCSV(path string, records [][]string) { - File, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0666) + File, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666) if err != nil { slog.Error("file open failed:%v", err) return