File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,8 @@ type GinkgoTestDescription struct {
149149 FileName string
150150 LineNumber int
151151
152- Failed bool
152+ Failed bool
153+ Duration time.Duration
153154}
154155
155156//CurrentGinkgoTestDescripton returns information about the current running test.
@@ -169,6 +170,7 @@ func CurrentGinkgoTestDescription() GinkgoTestDescription {
169170 FileName : subjectCodeLocation .FileName ,
170171 LineNumber : subjectCodeLocation .LineNumber ,
171172 Failed : summary .HasFailureState (),
173+ Duration : summary .RunTime ,
172174 }
173175}
174176
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ type Spec struct {
1919
2020 state types.SpecState
2121 runTime time.Duration
22+ startTime time.Time
2223 failure types.SpecFailure
2324 previousFailures bool
2425}
@@ -97,7 +98,7 @@ func (spec *Spec) Summary(suiteID string) *types.SpecSummary {
9798 ComponentTexts : componentTexts ,
9899 ComponentCodeLocations : componentCodeLocations ,
99100 State : spec .state ,
100- RunTime : spec .runTime ,
101+ RunTime : time . Since ( spec .startTime ) ,
101102 Failure : spec .failure ,
102103 Measurements : spec .measurementsReport (),
103104 SuiteID : suiteID ,
@@ -118,9 +119,9 @@ func (spec *Spec) Run(writer io.Writer) {
118119 spec .previousFailures = true
119120 }
120121
121- startTime : = time .Now ()
122+ spec . startTime = time .Now ()
122123 defer func () {
123- spec .runTime = time .Since (startTime )
124+ spec .runTime = time .Since (spec . startTime )
124125 }()
125126
126127 for sample := 0 ; sample < spec .subject .Samples (); sample ++ {
Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ var _ = Describe("Suite", func() {
121121 Ω (description .LineNumber ).Should (BeNumerically (">" , 50 ))
122122 Ω (description .LineNumber ).Should (BeNumerically ("<" , 150 ))
123123 Ω (description .Failed ).Should (BeFalse ())
124+ Ω (description .Duration ).Should (BeNumerically (">" , 0 ))
124125 })
125126
126127 Measure ("should run measurements" , func (b Benchmarker ) {
You can’t perform that action at this time.
0 commit comments