In the docs for the .runsettings-file there’s a section for adapter-specific settings:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>
<!-- Use 0 for maximum process-level parallelization. This does not force parallelization within the test DLL (on the thread-level). You can also change it from the Test menu; choose "Run tests in parallel". Unchecked = 1 (only 1), checked = 0 (max). -->
<MaxCpuCount>1</MaxCpuCount>
<!-- Path relative to directory that contains .runsettings file-->
<ResultsDirectory>.TestResults</ResultsDirectory>
</RunConfiguration>
<!-- Adapter Specific sections -->
<MyAdapter>
<WorkSpacePath>myfile.txt</WorkSpacePath>
</MyAdapter>
</RunSettings>
I’ve written my adapter by implementing ITestDiscoverer
and ITestExecutor
. Now I want to configure my adapter using the settings-file, but there’s no documentation about how to do that. While debugging my adapter I noticed that the IRunContext
-interface provides a property for the RunSettings
, that also includes my section.
Of course I could just parse the entire file, but that seems odd as that file already is de-serialized into said property. So I wonder how I can read these adapter-specific sections. I’ve tried using context.RunSettings.GetSettings("MyAdapter")
, but that gave me an ObjectMode.SettingsException
:
Settings Provider named ‘MyAdapter’ was not found. The settings can not be loaded.