Skip to content
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

Capture test stats so they can be processed in the TearDownTest function #98

Open
wants to merge 3 commits into
base: v1
Choose a base branch
from

Conversation

sebastien-rosset
Copy link

Currently, it is not possible to access the test stats (duration, nsperop, netBytes, netAllocs) within the TearDownTest() function. Since TearDownTest() is invoked after each test, it would be useful to have access to these stats attributes. For example, this could be used to write a TearDownTest() function that writes the results to a CSV file:

name,size,duration,nsPerOp
MyTest1,1,1253578,1.253578135s
MyTest2,1,178,1.789782398s
MyTest3,1,10642,5.321393621s

@sebastien-rosset
Copy link
Author

@jhenstridge can you take a look at this PR?

@jhenstridge
Copy link
Contributor

I don't have commit rights on the project, so you'll still need @niemeyer to approve and merge the changes.

I haven't really poked around in this part of the code much, but would this kind of thing make more sense to track through the Result struct? That currently only collects aggregate statistics, but you could make an argument that it should collect info about each individual test run.

You have access to the result object if you call RunSuite. It might be possible to have TestingT return the result too, without breaking existing users.

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.

2 participants