-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix bug with incorrect time duration of tests #66
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,11 +223,12 @@ func (result *Result) SkipOnPrint() { | |
} | ||
|
||
// Print If `Result.ToPrint` = `true` - the method terminates without creating any files. Otherwise: | ||
// - Calls `Result.PrintAttachments()`. | ||
// - Saves the file `uuid4-Result.json`. | ||
// - Calls `Result.Container.Print()` | ||
// - Returns error (if any) | ||
// - Calls `Result.PrintAttachments()`. | ||
// - Saves the file `uuid4-Result.json`. | ||
// - Calls `Result.Container.Print()` | ||
// - Returns error (if any) | ||
func (result *Result) Print() error { | ||
overWriteStartAndEndTime(result) | ||
if !result.ToPrint { | ||
return nil | ||
} | ||
|
@@ -300,3 +301,29 @@ func getMD5Hash(text string) string { | |
hash := md5.Sum([]byte(text)) | ||
return hex.EncodeToString(hash[:]) | ||
} | ||
|
||
// getTimeSumOfSteps gets first step start time and last step end time | ||
func getTimeSumOfSteps(result *Result) (startTimeInt int64, endTimeInt int64) { | ||
startTime := result.Steps[0].Start | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there will be panic if Steps array is empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. although, how are you going work with following case? func TestSome(t provider.T) {
time.Sleep(3 * time.Second)
t.WithNewStep(...)
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry,what do u mean? |
||
endTime := result.Steps[0].Start | ||
|
||
for i := range result.Steps { | ||
ladatkinS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if result.Steps[i].Stop > endTime { | ||
endTime = result.Steps[i].Stop | ||
} | ||
if result.Steps[i].Start < startTime { | ||
startTime = result.Steps[i].Start | ||
} | ||
} | ||
|
||
return startTime, endTime | ||
} | ||
|
||
func overWriteStartAndEndTime(result *Result) { | ||
if result.Status == Skipped { | ||
result.Stop = result.Start | ||
} else { | ||
result.Start, _ = getTimeSumOfSteps(result) | ||
ladatkinS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
_, result.Stop = getTimeSumOfSteps(result) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.