feat: Add API to set custom DefaultConfig.Instance#3051
feat: Add API to set custom DefaultConfig.Instance#3051filzrev wants to merge 1 commit intodotnet:masterfrom
DefaultConfig.Instance#3051Conversation
|
How is it expected to be used? The test adapter supports providing your own entry point by setting |
It's needed when running benchmarks from VS TestExplorer. When running benchmark via TestExplorer. |
Right, you said that already, but it doesn't explain how. |
The following code is expected API usage on VSTestAdapter (with VsTest). By this changes, It can specify custom arguments when running benchmark on Test Explorer. |
| { | ||
| } | ||
|
|
||
| public static void SetDefault(IConfig? config) |
There was a problem hiding this comment.
The name is misleading, it's actually setting Instance.
This PR add
DefaultConfig.SetDefault(config)API to customize default global config.Background
BenchmarkDotNet use
DefaultConfig.Instancewhen global config is not passed toBenchmarkRunner/BenchmarkSwitcher.On normarl use case, It can specify global config by using
Mainentry point.But when running benchmark via
TestAdaper, It can't useMainentry point (andlaunchsettings.json)So. it need to customize config via assembly-level ConfigAttribute.
https://benchmarkdotnet.org/articles/features/vstest.html?q=testadapter#setting-a-default-configuration
This PR add
DefaultConfig.SetDefault(config)API.By this change, it can use custom config by TestAdapter, (Settings are loaded from
.runsettings/testconfig.json)