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"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"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 {
|
func buildJUNITPackageSuite(suiteName string, startedAt time.Time, features []*feature) junitPackageSuite {
|
||||||
suite := junitPackageSuite{
|
suite := junitPackageSuite{
|
||||||
Name: suiteName,
|
Name: suiteName,
|
||||||
TestSuites: make([]*junitTestSuite, len(features)),
|
TestSuites: make([]*junitTestSuite, len(features)),
|
||||||
Time: fmt.Sprintf("%.f", timeNowFunc().Sub(startedAt).Seconds()),
|
Time: junitTimeDuration(startedAt, timeNowFunc()),
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(sortByName(features))
|
sort.Sort(sortByName(features))
|
||||||
|
@ -131,14 +136,15 @@ func buildJUNITPackageSuite(suiteName string, startedAt time.Time, features []*f
|
||||||
for idx, feat := range features {
|
for idx, feat := range features {
|
||||||
ts := junitTestSuite{
|
ts := junitTestSuite{
|
||||||
Name: feat.Name,
|
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)),
|
TestCases: make([]*junitTestCase, len(feat.Scenarios)),
|
||||||
}
|
}
|
||||||
|
|
||||||
for idx, scenario := range feat.Scenarios {
|
for idx, scenario := range feat.Scenarios {
|
||||||
tc := junitTestCase{}
|
tc := junitTestCase{
|
||||||
tc.Name = scenario.Name
|
Name: scenario.Name,
|
||||||
tc.Time = fmt.Sprintf("%.f", scenario.finishedAt().Sub(scenario.startedAt()).Seconds())
|
Time: junitTimeDuration(scenario.startedAt(), scenario.finishedAt()),
|
||||||
|
}
|
||||||
|
|
||||||
ts.Tests++
|
ts.Tests++
|
||||||
suite.Tests++
|
suite.Tests++
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче