-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use RunSettingsFilePath from when using dotnet test (#2272)
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
- Loading branch information
Showing
11 changed files
with
257 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
test/TestAssets/ProjectFileRunSettingsTestProject/ProjectFileRunSettingsTestProject.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<!-- Imports Common TestAssets props. --> | ||
<Import Project="..\..\..\scripts\build\TestAssets.props" /> | ||
<Import Project="..\..\..\scripts\build\TestPlatform.Dependencies.props" /> | ||
<!-- Package dependency versions --> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netcoreapp2.1;net451</TargetFrameworks> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<RunSettingsFilePath>fail.runsettings</RunSettingsFilePath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="MSTest.TestFramework"> | ||
<Version>$(MSTestFrameworkVersion)</Version> | ||
</PackageReference> | ||
<PackageReference Include="MSTest.TestAdapter"> | ||
<Version>$(MSTestAdapterVersion)</Version> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk"> | ||
<Version>$(NETTestSdkPreviousVersion)</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' "> | ||
<Reference Include="System.Runtime" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||
</ItemGroup> | ||
</Project> |
20 changes: 20 additions & 0 deletions
20
test/TestAssets/ProjectFileRunSettingsTestProject/UnitTest1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace ProjectFileRunSettingsTestProject | ||
{ | ||
[TestClass] | ||
public class UnitTest1 | ||
{ | ||
[TestMethod] | ||
public void TestMethod1() | ||
{ | ||
// this project specifies runsettings in it's proj file | ||
// that runsettings say that inconclusive should translate to | ||
// failed. | ||
// we can then easily figure out if the settings were applied | ||
// correctly if we set the test as failed, or did not apply if the | ||
// test is shown as skipped | ||
Assert.Inconclusive(); | ||
} | ||
} | ||
} |
Oops, something went wrong.