...
1 package reporter
2
3 import (
4 "fmt"
5 "os"
6 "path/filepath"
7 "time"
8
9 "github.com/onsi/ginkgo/config"
10 "github.com/onsi/ginkgo/reporters"
11 )
12
13
14 func JunitReport(filePath string) *reporters.JUnitReporter {
15 time := time.Now()
16 if _, err := os.Stat(filePath); os.IsNotExist(err) {
17 _ = os.Mkdir(filePath, os.ModePerm)
18 }
19 xmlFileName := fmt.Sprintf(filepath.Join(filePath, "junit_%d-%d-%d_%02d-%02d-%02d_%d.xml"), time.Year(), time.Month(),
20 time.Day(), time.Hour(), time.Minute(), time.Second(), config.GinkgoConfig.ParallelNode)
21 junitReporter := reporters.NewJUnitReporter(xmlFileName)
22 return junitReporter
23 }
24
View as plain text