Skip to content

Adjust duration output from the execution summary lines #23

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

Merged
merged 1 commit into from
Jan 7, 2016

Conversation

briancroom
Copy link
Contributor

Instead of outputting the average and summed execution time for each test
run, output the summed execution time of each test run and the total
elapsed time between the beginning and end of the test case's execution.
The new output follows the behavior of Darwin's XCTest framework.

Old behavior example excerpt:

Executed 22 tests, with 22 failures (0 unexpected) in 0.091 (2.008) seconds
Total executed 22 tests, with 22 failures (0 unexpected) in 0.091 (2.008) seconds

New behavior example excerpt (matching Darwin XCTest):

Executed 22 tests, with 22 failures (0 unexpected) in 2.006 (2.015) seconds
Total executed 22 tests, with 22 failures (0 unexpected) in 2.006 (2.016) seconds

Other implementation changes:

  • Add a typealias TimeInterval for Double to increase explicitness
  • Factor out a helper for measuring the time it takes to execute a piece of code

If this PR is accepted, it makes #21 obsolete, and also resolves SR-334.

@modocache
Copy link
Contributor

I definitely prefer the new output! I find the new output less surprising--the original discrepancy between 0.091 and 2.008 was confusing. Also, it matches the output of Apple XCTest. Thanks!! 💯

block()
let end = currentTimeIntervalSinceReferenceTime()

return end-start
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Other binary operations in this codebase, such as +=, have a space on each side of the operator. For consistency this should be return end - start, with spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@briancroom briancroom force-pushed the improveDurationOutput branch from bbe2fb6 to 61ddd74 Compare December 23, 2015 22:35
Instead of outputting the average and summed execution time for each test
run, output the summed execution time of each test run and the total
elapsed time between the beginning and end of the test case's execution.
The new output follows the behavior of Darwin's XCTest framework.
@mike-ferris
Copy link

Brian, thanks for the patches that fix up the output of the summaries and of the assertion failures. I'll look at them in detail as soon as I return!

Mike

On Dec 22, 2015, at 10:23 PM, Brian Croom [email protected] wrote:

Instead of outputting the average and summed execution time for each test
run, output the summed execution time of each test run and the total
elapsed time between the beginning and end of the test case's execution.
The new output follows the behavior of Darwin's XCTest framework.

Old behavior example excerpt:

Executed 22 tests, with 22 failures (0 unexpected) in 0.091 (2.008) seconds
Total executed 22 tests, with 22 failures (0 unexpected) in 0.091 (2.008) seconds
New behavior example excerpt (matching Darwin XCTest):

Executed 22 tests, with 22 failures (0 unexpected) in 2.006 (2.015) seconds
Total executed 22 tests, with 22 failures (0 unexpected) in 2.006 (2.016) seconds
Other implementation changes:

Add a typealias TimeInterval for Double to increase explicitness
Factor out a helper for measuring the time it takes to execute a piece of code
If this PR is accepted, it makes #21 obsolete, and also resolves SR-334.

You can view, comment on, or merge this pull request online at:

#23

Commit Summary

Adjust duration output from the summary output lines
File Changes

M XCTest/XCTestCase.swift (62)
M XCTest/XCTestMain.swift (13)
M XCTest/XCTimeUtilities.swift (20)
Patch Links:

https://github.com/apple/swift-corelibs-xctest/pull/23.patch
https://github.com/apple/swift-corelibs-xctest/pull/23.diff

Reply to this email directly or view it on GitHub.

@briancroom
Copy link
Contributor Author

👍 enjoy the holidays!

@mike-ferris
Copy link

this looks good to me. Presumably this subsumes the change in pull request #21. Can you please close that one?

mike-ferris pushed a commit that referenced this pull request Jan 7, 2016
Adjust duration output from the execution summary lines
@mike-ferris mike-ferris merged commit 4dd0e23 into swiftlang:master Jan 7, 2016
@briancroom briancroom deleted the improveDurationOutput branch January 7, 2016 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants