banditcpp / bandit

Human-friendly unit testing for C++11
https://banditcpp.github.io/bandit/
Other
259 stars 37 forks source link

Add test duration in the reporter #148

Closed MartinDelille closed 4 years ago

MartinDelille commented 4 years ago

I noticed xunit reporter contained the test execution duration and I wondered if it was possible to add this information to another reporter like info for example. Here is an example how it could display:

begin a calculator
  [ PASS ] it can add (0.074 ms)
  [ PASS ] it can substract (0.053 ms)
end a calculator (0.137 ms)

What would be the most convenient way:

sbeyer commented 4 years ago

I consider it a feature to not have duration information included, so outputs can be compared (e.g. with diff). Hence creating a new reporter would be the way that I prefer. If you want to make a PR for that, feel free. Please try to minimize code duplication.

Another way could be to add a --report-timing option (or a better name) that is passed to the reporters and they then handle the user's desire to see test execution durations. I am not sure if this makes sense with every reporter and how xunit should behave without that option.

sbeyer commented 4 years ago

(I added the inaction tag because I won't implement it. But I'm open to review and merge PRs.)