.net-coremstestspecflowspecrunrunsettings

Runsetting file NOT WORKING with SpecFlow+MSTest+SpecRun.Specflow


I checked almost all stack overflow and Microsoft documentation on how to read parameters from .runsettings file in MSTest and tried all the approaches but none worked for me.

I am using .NETCore 2.2, VS 2019, Selenium, SpecFlow+ Runner.

Does not Work with SpecRun.SpecFlow nuget Package but works with SpecFlow.MStest nuget package.

I tried to use it as mentioned here:

  1. How to read test run settings parameter value in specflow tests?
  2. https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2019
  3. How to access TestRunParameters within RunSettings file

None of them worked for me.

.runsettings file:

`

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
    <TestRunParameters>
    <Parameter name="appUrl" value="http://example.com" />
  </TestRunParameters>
</RunSettings>

I tried to get "appUrl":

public TestContext context {get;set;};

 [ClassInitialize]
    public static void TestClassinitialize(TestContext context)
    {
      var webAppUrl = context.Properties["appUrl"].ToString();
    }

I tried [AssemblyIntilize] / [TestInitialize] as well.

I don't know if MSTest supports this with SpecFlow+ Runner. Please help.

PLEASE HELP


Solution

  • It's an Open Issue:

    https://github.com/techtalk/SpecFlow/issues/817

    Have to wait.