Fixed an issue with missing decimals in JUnit
Этот коммит содержится в:
родитель
1a35035f3e
коммит
7565a32d21
1 изменённых файлов: 11 добавлений и 5 удалений
16
fmt_junit.go
16
fmt_junit.go
|
@ -6,6 +6,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -119,11 +120,15 @@ func (f *junitFormatter) Copy(cf ConcurrentFormatter) {
|
|||
}
|
||||
}
|
||||
|
||||
func junitTimeDuration(from, to time.Time) string {
|
||||
return strconv.FormatFloat(to.Sub(from).Seconds(), 'f', -1, 64)
|
||||
}
|
||||
|
||||
func buildJUNITPackageSuite(suiteName string, startedAt time.Time, features []*feature) junitPackageSuite {
|
||||
suite := junitPackageSuite{
|
||||
Name: suiteName,
|
||||
TestSuites: make([]*junitTestSuite, len(features)),
|
||||
Time: fmt.Sprintf("%.f", timeNowFunc().Sub(startedAt).Seconds()),
|
||||
Time: junitTimeDuration(startedAt, timeNowFunc()),
|
||||
}
|
||||
|
||||
sort.Sort(sortByName(features))
|
||||
|
@ -131,14 +136,15 @@ func buildJUNITPackageSuite(suiteName string, startedAt time.Time, features []*f
|
|||
for idx, feat := range features {
|
||||
ts := junitTestSuite{
|
||||
Name: feat.Name,
|
||||
Time: fmt.Sprintf("%.f", feat.finishedAt().Sub(feat.startedAt()).Seconds()),
|
||||
Time: junitTimeDuration(feat.startedAt(), feat.finishedAt()),
|
||||
TestCases: make([]*junitTestCase, len(feat.Scenarios)),
|
||||
}
|
||||
|
||||
for idx, scenario := range feat.Scenarios {
|
||||
tc := junitTestCase{}
|
||||
tc.Name = scenario.Name
|
||||
tc.Time = fmt.Sprintf("%.f", scenario.finishedAt().Sub(scenario.startedAt()).Seconds())
|
||||
tc := junitTestCase{
|
||||
Name: scenario.Name,
|
||||
Time: junitTimeDuration(scenario.startedAt(), scenario.finishedAt()),
|
||||
}
|
||||
|
||||
ts.Tests++
|
||||
suite.Tests++
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче