Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

LaunchSettings are not respected by Test Runner #1089

Open
plachor opened this issue Jul 9, 2019 · 6 comments
Open

LaunchSettings are not respected by Test Runner #1089

plachor opened this issue Jul 9, 2019 · 6 comments

Comments

@plachor
Copy link

plachor commented Jul 9, 2019

In latest Visual Studio 2019, Test Runner ignores environmentVariables configuration which would allow for instance configuration of ASPNETCORE_ENVIRONMENT.

This would be beneficial for integration tests that in local environment use different appsettings (non-production).

For instance I would like to define following launchSettings.json:

{
  "profiles": {
    "SomeFancyNamespace.ProjectName.Integration.Tests": {
      "commandName": "Project",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

There was an related issue that was closed: #456

@Bnjmn83
Copy link

Bnjmn83 commented Nov 7, 2019

Any news on this? Seems like a reasonable request

@svanimpelen
Copy link

Also interested in this. Would really like to see this feature

@davet74
Copy link

davet74 commented Dec 17, 2019

We are interested in this as well. Seems like something that a lot of us would like.

@alexander-lysenko-88
Copy link

I'm also looking forward for the fix.
Very annoying issue, and nobody replies regarding updates :(

@xantari
Copy link

xantari commented Jan 7, 2020

Also having this issue in .net core unit test projects. Whats the whole point of having the environment variables present in the property pages of a .net core unit test project when setting them does absolutely nothing.

They did not fix it with this request: #456
Also did not fix it with this request: microsoft/vstest#1831

The workaround in 1831 is not acceptable as it won't work well for redistributable libraries that you intend to unit test. Since Microsoft is pushing the environment variable way of configuration, it should be a first class citizen in unit test projects as well. Not just ASP .NET Core web application projects.

@IanKemp
Copy link

IanKemp commented Feb 21, 2020

The only current way to do it is to manually read the test project's launchSettings.json then manually set environment variables from its contents, as per https://stackoverflow.com/a/43951218/70345

It's a really s**tty way to do things and one that really should just be supported by the tooling, but for whatever reason Microsoft is uninterested in implementing it...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants