11

I am trying to run my end to end tests against the real environment using VS2019 in the IDE. The tests are located in separate test project within the main solution.

So I was trying to load environment variables using below two methods:

Method 1

Update launchSettings.json in the test project

{
  "profiles": {
    "My.Endpoint.Tests": {
      "commandName": "Project",
      "environmentVariables": {
        "ServerName": "Apim"

      }
    }
  }
}

Method 2

Create below cmd file and add it to the project and then call same in Build Events - Pre-build event command-line: in the test project properties.

set ServerName=Apim

Unfortunately none of the above methods can read the given environment variable when execute the tests via VS2019 IDE

5
  • Do you mean that you want to set the environment variables in the tested project and read the given environment variable when execute the tests ? Commented Sep 11, 2019 at 9:35
  • yes that's correct Commented Sep 11, 2019 at 11:29
  • 1
    a similar problem has already been reported to aspnet team in GitHub github.com/aspnet/Tooling/issues/1089, please vote for it. Commented Dec 24, 2019 at 12:40
  • Any update on this @SMPH?? Commented May 9, 2022 at 2:00
  • possible duplicate of this: stackoverflow.com/a/42035649/2097243 Commented Sep 14, 2022 at 16:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.