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

Adding tests for export of csv and csv Measurements #2387

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Nepp3r
Copy link

@Nepp3r Nepp3r commented Aug 1, 2023

Hello,
I've noticed, that in BenchmarkDotNet.Tests.Exporters.VerifiedFiles.CommonExporterVerifyTests was todo to add CsvExporter and CsvMeasurementsExporter, so I added them and mocked verified.txt files.

@Nepp3r
Copy link
Author

Nepp3r commented Aug 1, 2023

@dotnet-policy-service agree

@Nepp3r
Copy link
Author

Nepp3r commented Aug 2, 2023

I have a Fedora on VM box, so clear linux, and I ran same tests with my branch, but they ended without any errors, what would cause a problem on your Linux but not on my? All verified files have CRLF end of line symbols, including files I didn't change

@timcassell
Copy link
Collaborator

was todo to add CsvExporter and CsvMeasurementsExporter

Can you remove that todo since you did it?

Copy link
Collaborator

@timcassell timcassell left a comment

Choose a reason for hiding this comment

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

LGTM, but will wait for Andrey to take a look before merging.

Copy link
Member

@AndreyAkinshin AndreyAkinshin left a comment

Choose a reason for hiding this comment

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

I don't like this approach, specifically hacking the global instance of EnvironmentResolver.

The original idea behind IResolver was to provide an opportunity to easily customize the resolve logic for all the basic characteristics like affinity. Unfortunately, the resolver/characteristics system turned out to be overcomplicated, so it's not so easy to use it. Therefore, BenchmarkDotNet uses static instances of various resolvers here and there (like in BenchmarkDotNet.Columns.JobCharacteristicColumn.GetValue). A proper approach here is to somehow pass a resolver to all the places where it is needed so that it can be easily overridden in the tests.

It's always good to increase our test coverage, but I'd rather avoid introducing additional internal test-only methods for changing statistic instances. It makes our code base more fragile and increases the technical dept. A better solution is to invest efforts in refactoring the existing design so that we can write tests without using internal methods.

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.

None yet

4 participants