Support runsettings TestRunParameters
My MsTest project has a simple .runsettings file like this:
<RunSettings>
<TestRunParameters>
<Parameter name="foo" value="bar" />
</TestRunParameters>
</RunSettings>
These parameters are supposed to be injected at runtime into all test classes TestContext property
public TestContext TestContext { get; set; }
Then you can use that property like this:
[TestMethod]
public void TestMethod1()
{
Assert.AreEqual("bar", TestContext.Properties["foo"].ToString());
}
Unfortunately the this doesn't work when running NCrunch as the properties are not picked up. There doesn't seem to be a way to specify the path to the .runsettings file in NCrunch settings.
When running via Visual Studio or on Azure DevOps this works fine.
I'd prefer that runsettings (at the very least, just the TestRunParameters) were supported rather than environment variables, as that is the current recommended approach to provide parameters to a test project.