Support runsettings environment variables #3918
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new environment variable provider to the test framework and updates related tests and configurations. The main changes include adding the provider, updating the test infrastructure to use it, and modifying tests to validate its functionality.
New Environment Variable Provider:
src/Platform/Microsoft.Testing.Extensions.VSTestBridge/TestHostControllers/VSBridgeEnvironmentVariableProvider.cs
: Added a new classVSBridgeEnvironmentVariableProvider
to handle environment variables in the test host.src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/TestApplicationBuilderExtensions.cs
: Added a new methodAddEnvironmentVariableProvider
to register the environment variable provider.Test Infrastructure Updates:
src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestApplicationBuilderExtensions.cs
: Added a call toAddEnvironmentVariableProvider
in theAddMSTest
method.src/Platform/Microsoft.Testing.Extensions.VSTestBridge/PublicAPI.Unshipped.txt
: Updated the public API to include the newAddEnvironmentVariableProvider
method.Test and Configuration Updates:
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunsettingsTests.cs
: Updated tests to validate the new environment variable functionality, including adding environment variables to the test configuration and checking their values in tests. [1] [2] [3] [4] [5]test/IntegrationTests/MSTest.Acceptance.IntegrationTests/Properties/launchSettings.json
: Modified the command line arguments to filter the tests.Minor Updates:
samples/Playground/Tests.cs
: Added an assertion to check an environment variable in a test.src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/TestApplicationBuilderExtensions.cs
: Added necessaryusing
statements for the new provider.test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunsettingsTests.cs
: Included additionalusing
statements forRuntimeInformation
.