fix: get resultsPath

This commit is contained in:
lilong.129
2025-06-12 14:51:15 +08:00
parent 51ee639cac
commit 72df285fed
5 changed files with 103 additions and 44 deletions

View File

@@ -76,20 +76,8 @@ func (s *Summary) AddCaseSummary(caseSummary *TestCaseSummary) {
}
}
func (s *Summary) SetupDirPath() (path string, err error) {
dirPath := filepath.Join(s.rootDir, config.GetConfig().ResultsDir)
err = builtin.EnsureFolderExists(dirPath)
if err != nil {
return "", err
}
return dirPath, nil
}
func (s *Summary) GenHTMLReport() error {
reportsDir, err := s.SetupDirPath()
if err != nil {
return err
}
reportsDir := config.GetConfig().ResultsPath()
// Find summary.json and hrp.log files
summaryPath := filepath.Join(reportsDir, "summary.json")
@@ -107,11 +95,7 @@ func (s *Summary) GenHTMLReport() error {
}
func (s *Summary) GenSummary() (path string, err error) {
reportsDir, err := s.SetupDirPath()
if err != nil {
return "", err
}
reportsDir := config.GetConfig().ResultsPath()
path = filepath.Join(reportsDir, "summary.json")
err = builtin.Dump2JSON(s, path)
if err != nil {