Ability to Configure Environment Variables for Unit Tests (Specifically xUnit)

I have an xUnit project which from the IDE I run using the Unit Tests window or the run configuration All tests from Solution.

When configuring the All tests from Solution run configuration (or creating a new configuration), the name is the only configurable field and there is no way to specify environment variables. I'm using the Generic Host pattern to configure and expose my dependency injected resources. I need multi-environment support either through launchSettings or environment variables to configure the HostingEnvironment so different configurations can be tested, but there doesn't seem to be this capability in Rider. I think based on some search results I saw when searching on the problem that Visual Studio provides this capability for running xUnit / Unit Test projects.

This forum post is old but about the same / similar problem: https://rider-support.jetbrains.com/hc/en-us/community/posts/115000566430-How-to-set-Environment-to-Test-for-unit-test-runner- and one of the comments links to this youtrack issue: https://youtrack.jetbrains.com/issue/RIDER-4774 which is marked fixed but the neither comments on that issue nor the comments on any of it's related "fixed" issues say how it was fixed or what the acceptable workaround is.

1 comment
Comment actions Permalink

Hello,

Thank you for feedback. Thank you for your feedback. We have a feature request for adding ability to set different environmental variables for different sessions: RSPR-476109. We would appreciate if you would upvote the issue in order to demonstrate additional interest and bring increased awareness to the issue.

0

Please sign in to leave a comment.