Adding TestRunner resolvers that will be able to find a test runner based on different criteria.
Moving dotnet test command to its own library that can be shared between dotnet test and the test target in the SDK folder.
This commit is contained in:
parent
b5e00acc15
commit
8e432e567a
66 changed files with 426 additions and 49 deletions
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}"
|
||||
EndProject
|
||||
|
@ -26,8 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{17735A9D-B
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{0722D325-24C8-4E83-B5AF-0A083E7F0749}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MultiProjectValidator", "tools\MultiProjectValidator\MultiProjectValidator.xproj", "{08A68C6A-86F6-4ED2-89A7-B166D33E9F85}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "EndToEnd", "test\EndToEnd\EndToEnd.xproj", "{65741CB1-8AEE-4C66-8198-10A7EA0E4258}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProjects", "{713CBFBB-5392-438D-B766-A9A585EF1BB8}"
|
||||
|
@ -104,8 +102,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "update-dependencies", "buil
|
|||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Loader", "src\Microsoft.DotNet.ProjectModel.Loader\Microsoft.DotNet.ProjectModel.Loader.xproj", "{1C599FFD-FB52-4279-A8E5-465D3EC499E1}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Loader.Tests", "test\Microsoft.DotNet.ProjectModel.Loader.Tests\Microsoft.DotNet.ProjectModel.Loader.Tests.xproj", "{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Configurer", "src\Microsoft.DotNet.Configurer\Microsoft.DotNet.Configurer.xproj", "{E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Configurer.UnitTests", "test\Microsoft.DotNet.Configurer.UnitTests\Microsoft.DotNet.Configurer.UnitTests.xproj", "{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759}"
|
||||
|
@ -156,6 +152,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "publish", "publish", "{27B1
|
|||
build\publish\PublishContent.targets = build\publish\PublishContent.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-test-console", "src\dotnet-test-console\dotnet-test-console.xproj", "{6D028154-5518-4A56-BAD6-938A90E5BCF6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -776,22 +774,6 @@ Global
|
|||
{1C599FFD-FB52-4279-A8E5-465D3EC499E1}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{1C599FFD-FB52-4279-A8E5-465D3EC499E1}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{1C599FFD-FB52-4279-A8E5-465D3EC499E1}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Release|x64.Build.0 = Release|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
|
@ -872,6 +854,39 @@ Global
|
|||
{E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Release|x64.Build.0 = Release|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.Debug|x64.Build.0 = Debug|x64
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.MinSizeRel|Any CPU.ActiveCfg = MinSizeRel|Any CPU
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.MinSizeRel|Any CPU.Build.0 = MinSizeRel|Any CPU
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.Release|x64.ActiveCfg = Release|x64
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.Release|x64.Build.0 = Release|x64
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.RelWithDebInfo|Any CPU.ActiveCfg = RelWithDebInfo|Any CPU
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.RelWithDebInfo|Any CPU.Build.0 = RelWithDebInfo|Any CPU
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -920,7 +935,6 @@ Global
|
|||
{B768BD29-12BF-4C7C-B093-03193FE244D1} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{1C599FFD-FB52-4279-A8E5-465D3EC499E1} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{35B19F22-B8C0-4849-9C35-3F809B7588B8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
|
@ -930,5 +944,7 @@ Global
|
|||
{FF498306-2DE2-47F6-8C35-3CF0589CF2B8} = {89905EC4-BC0F-443B-8ADF-691321F10108}
|
||||
{E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{27B12960-ABB0-4903-9C60-5E9157E659C8} = {89905EC4-BC0F-443B-8ADF-691321F10108}
|
||||
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
|
@ -17,5 +18,10 @@ namespace Microsoft.Extensions.EnvironmentAbstractions
|
|||
{
|
||||
return new TemporaryDirectory();
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetFiles(string path, string searchPattern)
|
||||
{
|
||||
return Directory.GetFiles(path, searchPattern);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Extensions.EnvironmentAbstractions
|
||||
{
|
||||
internal interface IDirectory
|
||||
|
@ -8,5 +10,7 @@ namespace Microsoft.Extensions.EnvironmentAbstractions
|
|||
bool Exists(string path);
|
||||
|
||||
ITemporaryDirectory CreateTemporaryDirectory();
|
||||
|
||||
IEnumerable<string> GetFiles(string path, string searchPattern);
|
||||
}
|
||||
}
|
|
@ -7,4 +7,6 @@ using System.Runtime.CompilerServices;
|
|||
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
|
||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
|
||||
[assembly: InternalsVisibleTo("dotnet-test.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")]
|
||||
[assembly: InternalsVisibleTo("dotnet-test-console, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
|
|
|
@ -27,3 +27,7 @@ using System.Runtime.InteropServices;
|
|||
|
||||
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.DotNet.ProjectModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")]
|
||||
[assembly:
|
||||
InternalsVisibleTo(
|
||||
"dotnet-test.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796"
|
||||
)]
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyMetadata("Serviceable", "True")]
|
||||
[assembly: NeutralResourcesLanguage("en-us")]
|
||||
[assembly: NeutralResourcesLanguage("en-us")]
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test
|
||||
|
@ -59,7 +61,7 @@ namespace Microsoft.DotNet.Tools.Test
|
|||
strings.Add(projectContext.RuntimeIdentifier);
|
||||
}
|
||||
|
||||
var result = Build.BuildCommand.Run(strings.ToArray(), workspace);
|
||||
var result = Command.CreateDotNet("build", strings).Execute().ExitCode;
|
||||
|
||||
return result;
|
||||
}
|
|
@ -63,7 +63,7 @@ namespace Microsoft.DotNet.Tools.Test
|
|||
|
||||
private static string GetCommandName(string testRunner)
|
||||
{
|
||||
return $"test-{testRunner}";
|
||||
return $"dotnet-test-{testRunner}";
|
||||
}
|
||||
}
|
||||
}
|
27
src/dotnet-test-console/Properties/AssemblyInfo.cs
Normal file
27
src/dotnet-test-console/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
|
||||
[assembly: AssemblyTitle("dotnet_test_console")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("$safeprojectname$")]
|
||||
[assembly: AssemblyCopyright("Copyright © 116")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
|
||||
[assembly: Guid("6D028154-5518-4A56-BAD6-938A90E5BCF6")]
|
||||
[assembly: InternalsVisibleTo("dotnet-test.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")]
|
|
@ -8,20 +8,20 @@
|
|||
|
||||
## SYNOPSIS
|
||||
|
||||
`dotnet test [--configuration]
|
||||
`dotnet test [--configuration]
|
||||
[--output] [--build-base-path] [--framework] [--runtime]
|
||||
[--no-build]
|
||||
[--parentProcessId] [--port]
|
||||
[<project>]`
|
||||
[--parentProcessId] [--port]
|
||||
[<project>]`
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
The `dotnet test` command is used to execute unit tests in a given project. Unit tests are class library
|
||||
projects that have dependencies on the unit test framework (for example, NUnit or xUnit) and the
|
||||
dotnet test runner for that unit testing framework.
|
||||
The `dotnet test` command is used to execute unit tests in a given project. Unit tests are class library
|
||||
projects that have dependencies on the unit test framework (for example, NUnit or xUnit) and the
|
||||
dotnet test runner for that unit testing framework.
|
||||
These are packaged as NuGet packages and are restored as ordinary dependencies for the project.
|
||||
|
||||
Test projects also need to specify a test runner property in project.json using the "testRunner" node.
|
||||
Test projects also need to specify a test runner property in project.json using the "testRunner" node.
|
||||
This value should contain the name of the unit test framework.
|
||||
|
||||
The following sample project.json shows the properties needed:
|
||||
|
@ -53,17 +53,17 @@ The following sample project.json shows the properties needed:
|
|||
`dotnet test` supports two running modes:
|
||||
|
||||
1. Console: In console mode, `dotnet test` simply executes fully any command gets passed to it and outputs the results. Anytime you invoke `dotnet test` without passing --port, it runs in console mode, which in turn will cause the runner to run in console mode.
|
||||
2. Design time: used in the context of other tools, such as editors or Integrated Development Environments (IDEs). You can find out more about this mode in the [dotnet-test protocol](../../../../Documentation/dotnet-test-protocol.md) document.
|
||||
2. Design time: used in the context of other tools, such as editors or Integrated Development Environments (IDEs). You can find out more about this mode in the [dotnet-test protocol](../../../../Documentation/dotnet-test-protocol.md) document.
|
||||
|
||||
## OPTIONS
|
||||
|
||||
`[project]`
|
||||
|
||||
Specifies a path to the test project. If omitted, it defaults to current directory.
|
||||
|
||||
Specifies a path to the test project. If omitted, it defaults to current directory.
|
||||
|
||||
`-c`, `--configuration` [Debug|Release]
|
||||
|
||||
Configuration under which to build. The default value is Release.
|
||||
Configuration under which to build. The default value is Release.
|
||||
|
||||
`-o`, `--output` [DIR]
|
||||
|
||||
|
@ -81,9 +81,9 @@ Looks for test binaries for a specific framework.
|
|||
|
||||
Look for test binaries for a for the specified runtime.
|
||||
|
||||
`--no-build`
|
||||
`--no-build`
|
||||
|
||||
Does not build the test project prior to running it.
|
||||
Does not build the test project prior to running it.
|
||||
|
||||
--parentProcessId
|
||||
|
||||
|
@ -97,8 +97,8 @@ Used by IDEs to specify a port number to listen for a connection.
|
|||
|
||||
`dotnet test`
|
||||
|
||||
Runs the tests in the project in the current directory.
|
||||
Runs the tests in the project in the current directory.
|
||||
|
||||
`dotnet test /projects/test1/project.json`
|
||||
|
||||
Runs the tests in the test1 project.
|
||||
Runs the tests in the test1 project.
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -29,7 +29,7 @@ namespace Microsoft.DotNet.Tools.Test
|
|||
try
|
||||
{
|
||||
dotnetTestParams.Parse(args);
|
||||
|
||||
|
||||
if (dotnetTestParams.Help)
|
||||
{
|
||||
return 0;
|
|
@ -14,8 +14,8 @@ namespace Microsoft.DotNet.Tools.Test
|
|||
|
||||
static TestHostTracing()
|
||||
{
|
||||
Source = Environment.GetEnvironmentVariable(TracingEnvironmentVariable) == "1"
|
||||
? new TraceSource("dotnet-test", SourceLevels.Verbose)
|
||||
Source = Environment.GetEnvironmentVariable(TracingEnvironmentVariable) == "1"
|
||||
? new TraceSource("dotnet-test", SourceLevels.Verbose)
|
||||
: new TraceSource("dotnet-test", SourceLevels.Warning);
|
||||
|
||||
Source.Listeners.Add(new TextWriterTraceListener(Console.Error));
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test
|
||||
{
|
||||
public class AssemblyTestRunnerResolver : ITestRunnerResolver
|
||||
{
|
||||
private readonly string _assemblyUnderTestPath;
|
||||
|
||||
private readonly IDirectory _directory;
|
||||
|
||||
public AssemblyTestRunnerResolver(string assemblyUnderTestPath) :
|
||||
this(assemblyUnderTestPath, FileSystemWrapper.Default.Directory)
|
||||
{
|
||||
}
|
||||
|
||||
internal AssemblyTestRunnerResolver(string assemblyUnderTestPath, IDirectory directory)
|
||||
{
|
||||
_assemblyUnderTestPath = assemblyUnderTestPath;
|
||||
_directory = directory;
|
||||
}
|
||||
|
||||
public string ResolveTestRunner()
|
||||
{
|
||||
var testRunnerPath = _directory.GetFiles(_assemblyUnderTestPath, "dotnet-test-*").FirstOrDefault();
|
||||
|
||||
return Path.GetFileNameWithoutExtension(testRunnerPath);
|
||||
}
|
||||
}
|
||||
}
|
10
src/dotnet-test-console/TestRunners/ITestRunnerResolver.cs
Normal file
10
src/dotnet-test-console/TestRunners/ITestRunnerResolver.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test
|
||||
{
|
||||
public interface ITestRunnerResolver
|
||||
{
|
||||
string ResolveTestRunner();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test
|
||||
{
|
||||
public class ParameterTestRunnerResolver : ITestRunnerResolver
|
||||
{
|
||||
private readonly string _testRunner;
|
||||
|
||||
public ParameterTestRunnerResolver(string testRunner)
|
||||
{
|
||||
_testRunner = testRunner;
|
||||
}
|
||||
|
||||
public string ResolveTestRunner()
|
||||
{
|
||||
return $"dotnet-test-{_testRunner}";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test
|
||||
{
|
||||
public class ProjectJsonTestRunnerResolver : ITestRunnerResolver
|
||||
{
|
||||
private Project _project;
|
||||
|
||||
public ProjectJsonTestRunnerResolver(Project project)
|
||||
{
|
||||
_project = project;
|
||||
}
|
||||
|
||||
public string ResolveTestRunner()
|
||||
{
|
||||
return string.IsNullOrEmpty(_project.TestRunner) ? null : $"dotnet-test-{_project.TestRunner}";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,7 +51,7 @@ namespace Microsoft.DotNet.Tools.Test
|
|||
var commandArgs = _argumentsBuilder.BuildArguments();
|
||||
|
||||
return _commandFactory.Create(
|
||||
$"dotnet-{_testRunner}",
|
||||
$"{_testRunner}",
|
||||
commandArgs,
|
||||
null,
|
||||
null);
|
21
src/dotnet-test-console/dotnet-test-console.xproj
Normal file
21
src/dotnet-test-console/dotnet-test-console.xproj
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>6D028154-5518-4A56-BAD6-938A90E5BCF6</ProjectGuid>
|
||||
<RootNamespace>dotnet_test_console</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
38
src/dotnet-test-console/project.json
Normal file
38
src/dotnet-test-console/project.json
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"version": "1.0.0-featmsbuild-*",
|
||||
"buildOptions": {
|
||||
"keyFile": "../../tools/Key.snk",
|
||||
"compile": {
|
||||
"include": [
|
||||
"**/*.cs",
|
||||
"../dotnet/CommandLine/*.cs"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"System.Diagnostics.TraceSource": "4.0.0",
|
||||
"System.Diagnostics.TextWriterTraceListener": "4.0.0",
|
||||
"Microsoft.DotNet.Cli.Utils": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.ProjectModel": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.Extensions.Testing.Abstractions": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.InternalAbstractions": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"netstandard1.6": {
|
||||
"imports": [
|
||||
"portable-net45+wp80+win8+wpa81+dnxcore50"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,6 +45,9 @@
|
|||
"Microsoft.DotNet.Configurer": {
|
||||
"target": "project"
|
||||
},
|
||||
"dotnet-test-console": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.0"
|
||||
|
|
|
@ -118,6 +118,11 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
return _temporaryDirectory;
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetFiles(string path, string searchPattern)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Exists(string path)
|
||||
{
|
||||
return _files.Keys.Any(k => k.StartsWith(path));
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Tools.Test;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Dotnet.Tools.Test.Tests
|
||||
{
|
||||
public class GivenAParameterTestRunnerResolver
|
||||
{
|
||||
private const string SomeTestRunner = "Some test runner";
|
||||
|
||||
[Fact]
|
||||
public void It_returns_the_runner_based_on_the_parameter()
|
||||
{
|
||||
var parameterTestRunnerResolver = new ParameterTestRunnerResolver(SomeTestRunner);
|
||||
|
||||
var testRunner = parameterTestRunnerResolver.ResolveTestRunner();
|
||||
|
||||
testRunner.Should().Be($"dotnet-test-{SomeTestRunner}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.Tools.Test;
|
||||
using Microsoft.Extensions.Testing.Abstractions;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Dotnet.Tools.Test.Tests
|
||||
{
|
||||
public class GivenAProjectJsonTestRunnerResolver
|
||||
{
|
||||
private const string SomeTestRunner = "runner";
|
||||
|
||||
[Fact]
|
||||
public void It_resolves_the_TestRunner_using_the_testRunner_property_in_the_projectJson()
|
||||
{
|
||||
var project = new Project
|
||||
{
|
||||
TestRunner = SomeTestRunner
|
||||
};
|
||||
|
||||
var projectJsonTestRunnerResolver = new ProjectJsonTestRunnerResolver(project);
|
||||
|
||||
var testRunner = projectJsonTestRunnerResolver.ResolveTestRunner();
|
||||
|
||||
testRunner.Should().Be($"dotnet-test-{SomeTestRunner}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_returns_null_when_there_is_no_testRunner_set_in_the_projectJson()
|
||||
{
|
||||
var project = new Project();
|
||||
|
||||
var projectJsonTestRunnerResolver = new ProjectJsonTestRunnerResolver(project);
|
||||
|
||||
var testRunner = projectJsonTestRunnerResolver.ResolveTestRunner();
|
||||
|
||||
testRunner.Should().BeNull();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
|
|||
private Mock<ICommand> _commandMock;
|
||||
private Mock<ICommandFactory> _commandFactoryMock;
|
||||
private Mock<ITestRunnerArgumentsBuilder> _argumentsBuilderMock;
|
||||
private string _runner = "runner";
|
||||
private string _runner = "dotnet-test-runner";
|
||||
private string[] _testRunnerArguments;
|
||||
|
||||
public GivenATestRunner()
|
||||
|
@ -38,7 +38,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
|
|||
|
||||
_commandFactoryMock = new Mock<ICommandFactory>();
|
||||
_commandFactoryMock.Setup(c => c.Create(
|
||||
$"dotnet-{_runner}",
|
||||
$"{_runner}",
|
||||
_testRunnerArguments,
|
||||
null,
|
||||
null)).Returns(_commandMock.Object).Verifiable();
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Tools.Test;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
using Microsoft.Extensions.Testing.Abstractions;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Dotnet.Tools.Test.Tests
|
||||
{
|
||||
public class GivenAnAssemblyTestRunnerResolver
|
||||
{
|
||||
private const string PathToAssemblyUnderTest = "path to some assembly under test";
|
||||
|
||||
private const string TestRunnerName = "dotnet-test-someRunner";
|
||||
|
||||
private static readonly string TestRunnerFileName = $"{TestRunnerName}.dll";
|
||||
|
||||
[Fact]
|
||||
public void It_finds_the_runner_in_the_same_folder_as_the_assembly()
|
||||
{
|
||||
var directoryMock = new DirectoryMock();
|
||||
|
||||
directoryMock.AddFile(PathToAssemblyUnderTest, TestRunnerFileName);
|
||||
|
||||
var assemblyTestRunnerResolver = new AssemblyTestRunnerResolver(PathToAssemblyUnderTest, directoryMock);
|
||||
|
||||
var testRunner = assemblyTestRunnerResolver.ResolveTestRunner();
|
||||
|
||||
testRunner.Should().Be(TestRunnerName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_returns_a_test_runner_even_when_multiple_test_runners_are_present()
|
||||
{
|
||||
var directoryMock = new DirectoryMock();
|
||||
|
||||
directoryMock.AddFile(PathToAssemblyUnderTest, TestRunnerFileName);
|
||||
directoryMock.AddFile(PathToAssemblyUnderTest, "dotnet-test-someOtherTestRunner.dll");
|
||||
directoryMock.AddFile(PathToAssemblyUnderTest, "dotnet-test-AndYetAnotherTestRunner.dll");
|
||||
|
||||
var assemblyTestRunnerResolver = new AssemblyTestRunnerResolver(PathToAssemblyUnderTest, directoryMock);
|
||||
|
||||
var bestEffortTestRunner = assemblyTestRunnerResolver.ResolveTestRunner();
|
||||
|
||||
bestEffortTestRunner.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_returns_null_when_no_test_runner_is_found()
|
||||
{
|
||||
var directoryMock = new DirectoryMock();
|
||||
|
||||
var assemblyTestRunnerResolver = new AssemblyTestRunnerResolver(PathToAssemblyUnderTest, directoryMock);
|
||||
|
||||
var testRunner = assemblyTestRunnerResolver.ResolveTestRunner();
|
||||
|
||||
testRunner.Should().BeNull();
|
||||
}
|
||||
|
||||
private class DirectoryMock : IDirectory
|
||||
{
|
||||
private IList<string> _files = new List<string>();
|
||||
|
||||
public bool Exists(string path)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public ITemporaryDirectory CreateTemporaryDirectory()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetFiles(string path, string searchPattern)
|
||||
{
|
||||
var searchPatternRegex = new Regex(searchPattern);
|
||||
return _files.Where(f => f.StartsWith(path) && searchPatternRegex.IsMatch(f));
|
||||
}
|
||||
|
||||
public void AddFile(string path, string fileName)
|
||||
{
|
||||
_files.Add($"{path}/{fileName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,7 +6,10 @@
|
|||
"version": "1.0.0"
|
||||
},
|
||||
"Newtonsoft.Json": "9.0.1",
|
||||
"dotnet": {
|
||||
"dotnet-test-console": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.InternalAbstractions": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.Win32.Registry": {
|
||||
|
@ -34,6 +37,7 @@
|
|||
]
|
||||
},
|
||||
"buildOptions": {
|
||||
"keyFile": "../../tools/test_key.snk",
|
||||
"copyToOutput": {
|
||||
"include": [
|
||||
"../../TestAssets/TestProjects/ProjectsWithTests/NetCoreAppOnlyProject/project.json"
|
||||
|
|
Loading…
Reference in a new issue