Report test execution time at a higher resolution
Bug #1072379 reported by
Charlie Poole
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit Framework |
Fix Released
|
High
|
Charlie Poole | ||
NUnit V2 |
Fix Released
|
High
|
Charlie Poole | ||
NUnitLite |
Fix Released
|
High
|
Charlie Poole |
Bug Description
Currently, we measure test execution time using DateTime.Now, which depends on the System Timer. Per the docs, that gives us a resolution of 10ms, although it seems higher in practice, probably due to context switching time.
Really, if we want a good measure of how long it took to run a test, we should probably be using the Stopwatch class.
While we are at it, we should probably use a TimeSpan rather than a double to represent elapsed time in the TestResult class,
at least in NUnit 3.0, and possibly in the other projects as well. The NUnit 2.6 XML should continue to report time in seconds, while the NUnit 3.0 XML can use a string representation of the TimeSpan.
Changed in nunitv2: | |
status: | New → Triaged |
importance: | Undecided → High |
Changed in nunitlite: | |
status: | New → Triaged |
importance: | Undecided → High |
Changed in nunit-3.0: | |
status: | New → Triaged |
importance: | Undecided → High |
Changed in nunitlite: | |
assignee: | nobody → Charlie Poole (charlie.poole) |
Changed in nunitlite: | |
status: | Triaged → In Progress |
Changed in nunitlite: | |
status: | In Progress → Fix Committed |
milestone: | none → 0.9 |
Changed in nunitv2: | |
assignee: | nobody → Charlie Poole (charlie.poole) |
milestone: | none → 2.6.3 |
Changed in nunit-3.0: | |
milestone: | none → 2.9.6 |
Changed in nunitlite: | |
status: | In Progress → Fix Committed |
Changed in nunitv2: | |
status: | Triaged → Fix Committed |
Changed in nunit-3.0: | |
assignee: | nobody → Charlie Poole (charlie.poole) |
status: | Triaged → Fix Committed |
Changed in nunitlite: | |
status: | Fix Committed → Fix Released |
Changed in nunit-3.0: | |
status: | Fix Committed → Fix Released |
Changed in nunitv2: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
We should probably try to find out if the use of Stopwatch consumes too many resources on it's own, as compared to DateTime. If so, we can make the higher resolution an option. We should not use an option unnecessarily, however.