-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RunSettingsFilePath property isn't honored by VSTest #2265
Comments
A simple repro for this is to have a MSTest test project with a single inconclusive test and force the inconclusive state to translate to fail via run settings. This will give a failing test when settings are picked up and a skipped test when they are not. using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Assert.Inconclusive();
}
}
} Add the following <?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<MSTest>
<MapInconclusiveToFailed>True</MapInconclusiveToFailed>
</MSTest>
</RunSettings> and configure the project to pick up the settings file by adding this to your csproj: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
+ <RunSettingsFilePath>$(SolutionDir)\example.runsettings</RunSettingsFilePath>
</PropertyGroup> Now running it via Test runner will report the test as failed, while running it via |
This issue is currently being discussed here #2229 |
Uses the RunSettingsFilePath from project file when specified and falls back to the one specified in console, or the default setting if none are provided. The path to the settings file can be specified in multiple ways, for example as a path relative to the project file. This enables `dotnet test` to be invoked against the project file directly. ```xml <RunSettingsFilePath>$(ProjectDir)..\example.runsettings</RunSettingsFilePath> ``` Alternatively path can also be specified relatively to solution file, but that will only work when running dotnet test against the solution. On the other hand the setting will be the same in all projects. ```xml <RunSettingsFilePath>$(SolutionDir)\example.runsettings</RunSettingsFilePath> ``` Fixes microsoft#2265
Uses the RunSettingsFilePath from project file when specified and falls back to the one specified in console, or the default setting if none are provided. The path to the settings file can be specified in multiple ways, for example as a path relative to the project file. This enables `dotnet test` to be invoked against the project file directly. ```xml <RunSettingsFilePath>$(ProjectDir)..\example.runsettings</RunSettingsFilePath> ``` Alternatively path can also be specified relatively to solution file, but that will only work when running dotnet test against the solution. On the other hand the setting will be the same in all projects. ```xml <RunSettingsFilePath>$(SolutionDir)\example.runsettings</RunSettingsFilePath> ``` Fixes #2265
The property
RunSettingsFilePath
which points to the local .runsettings file for the test session should be honored by VSTest and not just by Visual Studio. Doc that points to that property: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2019#visual-studio-2019-version-164-and-laterWe need this in the runtime repo (converged repo of coreclr, corefx and core-setup) to configure our test sessions without always needing to type the path to the runsettings file. Our end-goal is that
dotnet test
is sufficient to run our tests.cc @ManishJayaswal @singhsarab
The text was updated successfully, but these errors were encountered: