title: How do I pass runtime parameters to dotnet test on the command line?
body: <p>I have a set of unit tests in a .NET Core project and using a runsettings file. I am trying to setup Azure DevOps to do automated testing on my deployments. As part of this process, I need to override parameters from the run settings on the command line.</p>
  <p>I have a runsettings file with the following section:</p>
  <pre><code>  &lt;TestRunParameters&gt;
      &lt;Parameter name=&quot;ApiUrl&quot; value=&quot;https://myurl...&quot; /&gt;
    &lt;/TestRunParameters&gt;
  </code></pre>
  <p>I have a static constructor that saves the TestContext like this:</p>
  <pre><code>        [ClassInitialize]
          public static void TestClassInitialize(TestContext context)
          {
              TestContext = context;
          }
  </code></pre>
  <p>I am retrieving settings from the TestContext with the following method:</p>
  <pre><code>        protected string GetStringSetting(string settingName)
          {
              return TestContext.Properties[settingName] as string;
          }
  </code></pre>
  <p>When I run the test with the runsettings file selected, it gets the TestContext and I see the ApiUrl entry is retrieved successfully.</p>
  <p>Now, I want to set this parameter from the command line. I am using a command like:</p>
  <pre><code>    dotnet test &lt;myproject.csproj&gt; --configuration Release -- ApiUrl=https://newurl
  </code></pre>
  <p>I get an error that says the dictionary does not contain the key &quot;ApiUrl&quot; which indicates that the setting was not processed. From reading documentation, I thought that maybe I need to fully specify the name of the setting with TestRunParameters.ApiUrl. This gives me an XML error.</p>
  <p>From everything I have read, I think I am doing this right and can't figure out what is wrong. I am using version 2.1.503 of the tools.</p>
  <p>Can someone please give me guidance on how to make this work?</p>