diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/AppxManifest.xml b/src/Microsoft.DotNet.Uap.TestTools/AppxManifest.xml similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/AppxManifest.xml rename to src/Microsoft.DotNet.Uap.TestTools/AppxManifest.xml diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/LockScreenLogo.png b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/LockScreenLogo.png similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/LockScreenLogo.png rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/LockScreenLogo.png diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/SplashScreen.png b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/SplashScreen.png similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/SplashScreen.png rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/SplashScreen.png diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Square150x150Logo.png b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Square150x150Logo.png similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Square150x150Logo.png rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Square150x150Logo.png diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Square310x310Logo.png b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Square310x310Logo.png similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Square310x310Logo.png rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Square310x310Logo.png diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Square44x44Logo.png b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Square44x44Logo.png similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Square44x44Logo.png rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Square44x44Logo.png diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Square71x71Logo.png b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Square71x71Logo.png similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Square71x71Logo.png rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Square71x71Logo.png diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/StoreLogo.png b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/StoreLogo.png similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/StoreLogo.png rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/StoreLogo.png diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Wide310x150Logo.png b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Wide310x150Logo.png similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Assets/Wide310x150Logo.png rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Assets/Wide310x150Logo.png diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Microsoft.DotNet.XUnitRunnerUap.csproj b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Microsoft.DotNet.XUnitRunnerUap.csproj similarity index 74% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Microsoft.DotNet.XUnitRunnerUap.csproj rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Microsoft.DotNet.XUnitRunnerUap.csproj index f8a680dac51..6ee0c0f8fd3 100644 --- a/src/Microsoft.DotNet.XUnitRunnerUap/src/Microsoft.DotNet.XUnitRunnerUap.csproj +++ b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Microsoft.DotNet.XUnitRunnerUap.csproj @@ -125,12 +125,43 @@ PackageReference - - - + + CommandLine.cs + + + ConsoleRunner.cs + + + ParallelismOption.cs + + + Program.cs + + + RemoteExecutor.cs + + + Sinks\DiagnosticMessageSink.cs + + + Utility\Transform.cs + + + Utility\TransformFactory.cs + + + Utility\ConsoleRunnerLogger.cs + + + common\ConsoleHelper.cs + + + common\DictionaryExtensions.cs + + + common\Json.cs + - - @@ -138,6 +169,18 @@ + + HTML.xslt + + + JUnitXml.xslt + + + NUnitXml.xslt + + + xUnit1.xslt + @@ -149,8 +192,13 @@ + + 2.2.1 + runtime; build; native; contentfiles; analyzers + all + - 6.2.0-Preview1-26502-02 + 6.2.0-preview1-26926-04 2.4.1-pre.build.4059 diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Microsoft.DotNet.XUnitRunnerUap_TemporaryKey.pfx b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Microsoft.DotNet.XUnitRunnerUap_TemporaryKey.pfx similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Microsoft.DotNet.XUnitRunnerUap_TemporaryKey.pfx rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Microsoft.DotNet.XUnitRunnerUap_TemporaryKey.pfx diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Package.appxmanifest b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Package.appxmanifest similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Package.appxmanifest rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Package.appxmanifest diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Properties/AssemblyInfo.cs b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Properties/AssemblyInfo.cs similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Properties/AssemblyInfo.cs rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Properties/AssemblyInfo.cs diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Properties/Default.rd.xml b/src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Properties/Default.rd.xml similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/Properties/Default.rd.xml rename to src/Microsoft.DotNet.Uap.TestTools/Microsoft.DotNet.XUnitRunnerUap/Properties/Default.rd.xml diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/README.md b/src/Microsoft.DotNet.Uap.TestTools/README.md similarity index 79% rename from src/Microsoft.DotNet.XUnitRunnerUap/README.md rename to src/Microsoft.DotNet.Uap.TestTools/README.md index 1ba67eba023..275cdac1b89 100644 --- a/src/Microsoft.DotNet.XUnitRunnerUap/README.md +++ b/src/Microsoft.DotNet.Uap.TestTools/README.md @@ -12,7 +12,7 @@ Supported platforms: - ARM and ARM64 tools installed - Windows 10 >= v10.0.17134 (April 2018 Update) - To build and bundle the runner and launcher for deployment invoke the `buildAndUpdate.bat` script as following: `.\buildAndUpdate.bat src Launcher bin`. This will create an output directory (third parameter) which can be copied into the existing nuget package `Microsoft.DotNet.Uap.TestTools` for updates. + To build and bundle the runner and launcher for deployment invoke the `buildAndUpdate.bat` script as following: `.\buildAndUpdate.bat Microsoft.DotNet.XUnitRunnerUap WindowsStoreAppLauncher ..\Microsoft.DotNet.XUnitConsoleRunner\src bin\microsoft.dotnet.uap.testtools`. This will create an output directory (third parameter) which can be copied into the existing nuget package `Microsoft.DotNet.Uap.TestTools` for updates. ## Microsoft.DotNet.XUnitRunnerUap diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/App.h b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/App.h similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/App.h rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/App.h diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/AppxApp.cpp b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/AppxApp.cpp similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/AppxApp.cpp rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/AppxApp.cpp diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/AppxApp.h b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/AppxApp.h similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/AppxApp.h rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/AppxApp.h diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Args.h b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Args.h similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Args.h rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Args.h diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Stream.cpp b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Stream.cpp similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Stream.cpp rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Stream.cpp diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Stream.h b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Stream.h similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Stream.h rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Stream.h diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Support.cpp b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Support.cpp similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Support.cpp rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Support.cpp diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Support.h b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Support.h similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/Support.h rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/Support.h diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreApp.cpp b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreApp.cpp similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreApp.cpp rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreApp.cpp diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreApp.h b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreApp.h similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreApp.h rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreApp.h diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreApp.rc b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreApp.rc similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreApp.rc rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreApp.rc diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreAppLauncher.cpp b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreAppLauncher.cpp similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreAppLauncher.cpp rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreAppLauncher.cpp diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreAppLauncher.vcxproj b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreAppLauncher.vcxproj similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/WindowsStoreAppLauncher.vcxproj rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/WindowsStoreAppLauncher.vcxproj diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/stdafx.cpp b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/stdafx.cpp similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/stdafx.cpp rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/stdafx.cpp diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Launcher/stdafx.h b/src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/stdafx.h similarity index 100% rename from src/Microsoft.DotNet.XUnitRunnerUap/Launcher/stdafx.h rename to src/Microsoft.DotNet.Uap.TestTools/WindowsStoreAppLauncher/stdafx.h diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/buildAndUpdate.bat b/src/Microsoft.DotNet.Uap.TestTools/buildAndUpdate.bat similarity index 66% rename from src/Microsoft.DotNet.XUnitRunnerUap/buildAndUpdate.bat rename to src/Microsoft.DotNet.Uap.TestTools/buildAndUpdate.bat index 0ab44ea0296..a1945c71a06 100644 --- a/src/Microsoft.DotNet.XUnitRunnerUap/buildAndUpdate.bat +++ b/src/Microsoft.DotNet.Uap.TestTools/buildAndUpdate.bat @@ -2,7 +2,8 @@ setlocal echo off set RunnerSourceFolder=%1 set LauncherSourceFolder=%2 - set DestinationFolder=%3 + set XUnitConsoleRunnerFolder=%3 + set DestinationFolder=%4 call :LauncherMain x86 call :RunnerMain x86 @@ -16,6 +17,8 @@ setlocal call :LauncherMain arm64 call :RunnerMain arm64 + call :XUnitConsoleRunner + echo on goto :EOF @@ -26,7 +29,15 @@ setlocal msbuild /t:rebuild "%LauncherSourceFolder%\WindowsStoreAppLauncher.vcxproj" /p:Platform=%_platform% /p:Configuration=Release REM Copy the launcher executable - xcopy /y "%LauncherSourceFolder%\bin\%_platform%\Release\WindowsStoreAppLauncher.exe" "%DestinationFolder%\%_platform%\Launcher\" + xcopy /y "%LauncherSourceFolder%\bin\%_platform%\Release\WindowsStoreAppLauncher.exe" "%DestinationFolder%\Tools\%_platform%\Launcher\" + GOTO :EOF + +:XUnitConsoleRunner + REM Rebuild the runner + msbuild /t:rebuild "%XUnitConsoleRunnerFolder%\Microsoft.DotNet.XUnitConsoleRunner.csproj" /p:DefineConstants="WINDOWS_UWP" /p:OutputPath="bin\WINDOWS_UWP" + + REM Copy the runner executable + xcopy /y "%XUnitConsoleRunnerFolder%\bin\WINDOWS_UWP\*" "%DestinationFolder%\lib\netcoreapp2.0\" GOTO :EOF :RunnerMain @@ -42,12 +53,13 @@ setlocal IF "%_platform%" == "arm64" ( makeappx unpack /l /o /p "%RunnerSourceFolder%\bin\AppPackages\Microsoft.DotNet.XUnitRunnerUap_1.0.0.0_%_platform%_Debug_Test\Dependencies\%_platform%\Microsoft.VCLibs.%_platform%.14.00.appx" /d "%RunnerSourceFolder%\bin\unpack\Microsoft.VCLibs.%_platform%.Debug.14.00\%_platform%" ) ELSE ( - makeappx unpack /l /o /p "%RunnerSourceFolder%\bin\AppPackages\Microsoft.DotNet.XUnitRunnerUap_1.0.0.0_%_platform%_Debug_Test\Dependencies\%_platform%\Microsoft.NET.CoreRuntime.2.1.appx" /d "%RunnerSourceFolder%\bin\unpack\Microsoft.NET.CoreRuntime.2.1\%_platform%" + makeappx unpack /l /o /p "%RunnerSourceFolder%\bin\AppPackages\Microsoft.DotNet.XUnitRunnerUap_1.0.0.0_%_platform%_Debug_Test\Dependencies\%_platform%\Microsoft.NET.CoreRuntime.2.2.appx" /d "%RunnerSourceFolder%\bin\unpack\Microsoft.NET.CoreRuntime.2.2\%_platform%" + makeappx unpack /l /o /p "%RunnerSourceFolder%\bin\AppPackages\Microsoft.DotNet.XUnitRunnerUap_1.0.0.0_%_platform%_Debug_Test\Dependencies\%_platform%\Microsoft.NET.CoreFramework.Debug.2.2.appx" /d "%RunnerSourceFolder%\bin\unpack\Microsoft.NET.CoreFramework.Debug.2.2\%_platform%" makeappx unpack /l /o /p "%RunnerSourceFolder%\bin\AppPackages\Microsoft.DotNet.XUnitRunnerUap_1.0.0.0_%_platform%_Debug_Test\Dependencies\%_platform%\Microsoft.VCLibs.%_platform%.Debug.14.00.appx" /d "%RunnerSourceFolder%\bin\unpack\Microsoft.VCLibs.%_platform%.Debug.14.00\%_platform%" ) REM Copy the files we care about from the unpacked folder - call :RunnerCopy "%RunnerSourceFolder%\bin\unpack" "%DestinationFolder%\%_platform%\Runner" + call :RunnerCopy "%RunnerSourceFolder%\bin\unpack" "%DestinationFolder%\Tools\%_platform%\Runner" GOTO :EOF :RunnerCopy @@ -71,27 +83,24 @@ setlocal IF "%_platform%" == "arm64" ( xcopy /y %_mainSource%\clrcompression.dll %_dest%\ xcopy /y %_mainSource%\Microsoft.DotNet.XUnitRunnerUap.dll %_dest%\ - xcopy /y %_mainSource%\mrt100.dll %_dest%\ - xcopy /y %_mainSource%\mrt100_app.dll %_dest%\ - xcopy /y %_mainSource%\vcruntime140_app.dll %_dest%\ ) ELSE ( xcopy /y %_mainSource%\entrypoint\Microsoft.DotNet.XUnitRunnerUap.exe %_dest%\entrypoint\ xcopy /y %_mainSource%\Properties\Default.rd.xml %_dest%\Properties\ xcopy /y %_mainSource%\WinMetadata\Windows.winmd %_dest%\WinMetadata\ - xcopy /y %_mainSource%\System.ServiceModel.dll %_dest%\ - xcopy /y %_mainSource%\System.ServiceModel.Duplex.dll %_dest%\ - xcopy /y %_mainSource%\System.ServiceModel.Http.dll %_dest%\ - xcopy /y %_mainSource%\System.ServiceModel.NetTcp.dll %_dest%\ - xcopy /y %_mainSource%\System.ServiceModel.Primitives.dll %_dest%\ - xcopy /y %_mainSource%\System.ServiceModel.Security.dll %_dest%\ - xcopy /y %_mainSource%\System.ServiceModel.Web.dll %_dest%\ - xcopy /y %_mainSource%\System.ServiceProcess.dll %_dest%\ + xcopy /y "%_source%\Microsoft.NET.CoreFramework.Debug.2.2\%_platform%\System.ServiceModel.dll" %_dest%\ + xcopy /y "%_source%\Microsoft.NET.CoreFramework.Debug.2.2\%_platform%\System.ServiceModel.Duplex.dll" %_dest%\ + xcopy /y "%_source%\Microsoft.NET.CoreFramework.Debug.2.2\%_platform%\System.ServiceModel.Http.dll" %_dest%\ + xcopy /y "%_source%\Microsoft.NET.CoreFramework.Debug.2.2\%_platform%\System.ServiceModel.NetTcp.dll" %_dest%\ + xcopy /y "%_source%\Microsoft.NET.CoreFramework.Debug.2.2\%_platform%\System.ServiceModel.Primitives.dll" %_dest%\ + xcopy /y "%_source%\Microsoft.NET.CoreFramework.Debug.2.2\%_platform%\System.ServiceModel.Security.dll" %_dest%\ + xcopy /y "%_source%\Microsoft.NET.CoreFramework.Debug.2.2\%_platform%\System.ServiceModel.Web.dll" %_dest%\ + xcopy /y "%_source%\Microsoft.NET.CoreFramework.Debug.2.2\%_platform%\System.ServiceProcess.dll" %_dest%\ xcopy /y %_mainSource%\xunit.abstractions.dll %_dest%\ xcopy /y %_mainSource%\xunit.assert.dll %_dest%\ xcopy /y %_mainSource%\xunit.core.dll %_dest%\ xcopy /y %_mainSource%\xunit.execution.dotnet.dll %_dest%\ xcopy /y %_mainSource%\xunit.runner.utility.uwp10.dll %_dest%\ - xcopy /y "%_source%\Microsoft.NET.CoreRuntime.2.1\%_platform%\uwphost.dll" "%_dest%\" + xcopy /y "%_source%\Microsoft.NET.CoreRuntime.2.2\%_platform%\uwphost.dll" "%_dest%\" ) GOTO:EOF diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/ConsoleRunner.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/ConsoleRunner.cs index b7ebf62d0c2..b16d93ffbe6 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/ConsoleRunner.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/ConsoleRunner.cs @@ -28,6 +28,14 @@ public ConsoleRunner(object consoleLock) public int EntryPoint(string[] args) { +#if WINDOWS_UWP + // Handle RemoteExecutor + if (args.Length > 0 && args[0] == "remote") + { + return RemoteExecutor.Execute(args.Skip(1).ToArray()); + } +#endif + commandLine = CommandLine.Parse(args); try @@ -169,9 +177,8 @@ List GetAvailableRunnerReporters() void PrintHeader() { var platform = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; - var versionAttribute = typeof(ConsoleRunner).GetTypeInfo().Assembly.GetCustomAttribute(); - Console.WriteLine($"xUnit.net Console Runner v{versionAttribute.InformationalVersion} ({IntPtr.Size * 8}-bit {platform})"); + Console.WriteLine($"Microsoft.DotNet.XUnitConsoleRunner v2.5.0 ({IntPtr.Size * 8}-bit {platform})"); } void PrintUsage(IReadOnlyList reporters) @@ -355,7 +362,9 @@ XElement ExecuteAssembly(object consoleLock, var shadowCopy = assembly.Configuration.ShadowCopyOrDefault; var longRunningSeconds = assembly.Configuration.LongRunningTestSecondsOrDefault; +#if !WINDOWS_UWP using (AssemblyHelper.SubscribeResolveForAssembly(assembly.AssemblyFilename, internalDiagnosticsMessageSink)) +#endif using (var controller = new XunitFrontController(appDomainSupport, assembly.AssemblyFilename, assembly.ConfigFilename, shadowCopy, diagnosticMessageSink: diagnosticMessageSink)) using (var discoverySink = new TestDiscoverySink(() => cancel)) { diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj index 9d61aeb9800..2f4446cfbee 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj @@ -6,10 +6,11 @@ true Exe Xunit.ConsoleClient - netcoreapp2.0 + netcoreapp2.0 true 2.5.0 latest + $(DefaultItemExcludes);common\AssemblyResolution\*.cs diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Program.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Program.cs index a7f8026a0d2..47a1b41819b 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Program.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Program.cs @@ -13,7 +13,9 @@ public static int Main(string[] args) var consoleLock = new object(); var internalDiagnosticsMessageSink = DiagnosticMessageSink.ForInternalDiagnostics(consoleLock, args.Contains("-internaldiagnostics"), args.Contains("-nocolor")); +#if !WINDOWS_UWP using (AssemblyHelper.SubscribeResolveForAssembly(typeof(Program), internalDiagnosticsMessageSink)) +#endif return new ConsoleRunner(consoleLock).EntryPoint(args); } } diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/RemoteExecutor.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/RemoteExecutor.cs similarity index 90% rename from src/Microsoft.DotNet.XUnitRunnerUap/src/RemoteExecutor.cs rename to src/Microsoft.DotNet.XUnitConsoleRunner/src/RemoteExecutor.cs index 8ce6c0a1158..e47d337c157 100644 --- a/src/Microsoft.DotNet.XUnitRunnerUap/src/RemoteExecutor.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/RemoteExecutor.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if WINDOWS_UWP + using System; using System.IO; using System.Reflection; @@ -10,7 +12,7 @@ using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; -namespace Microsoft.DotNet.XUnitRunnerUap +namespace Xunit.ConsoleClient { /// /// Provides an entry point in a new process that will load a specified method and invoke it. @@ -113,22 +115,6 @@ public static int Execute(string[] args) return exitCode; } - private static MethodInfo GetMethod(this Type type, string methodName) - { - Type t = type; - while (t != null) - { - TypeInfo ti = t.GetTypeInfo(); - MethodInfo mi = ti.GetDeclaredMethod(methodName); - if (mi != null) - { - return mi; - } - t = ti.BaseType; - } - return null; - } - private static T[] Subarray(this T[] arr, int offset, int count) { var newArr = new T[count]; @@ -137,3 +123,5 @@ private static T[] Subarray(this T[] arr, int offset, int count) } } } + +#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Utility/ConsoleRunnerLogger.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Utility/ConsoleRunnerLogger.cs new file mode 100644 index 00000000000..935269ef8a5 --- /dev/null +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Utility/ConsoleRunnerLogger.cs @@ -0,0 +1,84 @@ +#if WINDOWS_UWP + +using System; + +namespace Xunit.ConsoleClient +{ + /// + /// An implementation of which logs messages + /// to and . + /// + public class ConsoleRunnerLogger : IRunnerLogger + { + readonly object lockObject; + readonly bool useColors; + + /// + /// Initializes a new instance of the class. + /// + /// A flag to indicate whether colors should be used when + /// logging messages. + public ConsoleRunnerLogger(bool useColors) : this(useColors, new object()) { } + + /// + /// Initializes a new instance of the class. + /// + /// A flag to indicate whether colors should be used when + /// logging messages. + /// The lock object used to prevent console clashes. + public ConsoleRunnerLogger(bool useColors, object lockObject) + { + this.useColors = useColors; + this.lockObject = lockObject; + } + + /// + public object LockObject => lockObject; + + /// + public void LogError(StackFrameInfo stackFrame, string message) + { + using (SetColor(ConsoleColor.Red)) + lock (LockObject) + Console.Error.WriteLine(message); + } + + /// + public void LogImportantMessage(StackFrameInfo stackFrame, string message) + { + using (SetColor(ConsoleColor.Gray)) + lock (LockObject) + Console.WriteLine(message); + } + + /// + public void LogMessage(StackFrameInfo stackFrame, string message) + { + using (SetColor(ConsoleColor.DarkGray)) + lock (LockObject) + Console.WriteLine(message); + } + + /// + public void LogWarning(StackFrameInfo stackFrame, string message) + { + using (SetColor(ConsoleColor.Yellow)) + lock (LockObject) + Console.WriteLine(message); + } + + IDisposable SetColor(ConsoleColor color) + => useColors ? new ColorRestorer(color) : null; + + class ColorRestorer : IDisposable + { + public ColorRestorer(ConsoleColor color) + => ConsoleHelper.SetForegroundColor(color); + + public void Dispose() + => ConsoleHelper.ResetColor(); + } + } +} + +#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Utility/TransformFactory.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Utility/TransformFactory.cs index a939e499cdb..7a54089729f 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Utility/TransformFactory.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Utility/TransformFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/AssemblyHelper.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/AssemblyHelper.cs index 329034bee64..1c7893b3cbf 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/AssemblyHelper.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/AssemblyHelper.cs @@ -1,5 +1,3 @@ -#if NETCOREAPP - using System; using System.IO; using System.Reflection; @@ -103,5 +101,3 @@ public static IDisposable SubscribeResolveForAssembly(Type typeInAssembly, IMess => new AssemblyHelper(typeInAssembly.GetTypeInfo().Assembly.Location, internalDiagnosticsMessageSink); } } - -#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/AssemblyHelper.uap.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/AssemblyHelper.uap.cs deleted file mode 100644 index 83accd435b4..00000000000 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/AssemblyHelper.uap.cs +++ /dev/null @@ -1,33 +0,0 @@ -#if WINDOWS_UAP - -using System; -using Xunit.Abstractions; - -namespace Xunit -{ - /// - /// This class provides assistance with assembly resolution for missing assemblies. - /// - static class AssemblyHelper - { - /// - /// Subscribes to the appropriate assembly resolution event, to provide automatic assembly resolution for - /// an assembly and any of its dependencies. Depending on the target platform, this may include the use - /// of the .deps.json file generated during the build process. - /// - /// An object which, when disposed, un-subscribes. - public static IDisposable SubscribeResolveForAssembly(string assemblyFileName, IMessageSink internalDiagnosticsMessageSink = null) - => null; - - /// - /// Subscribes to the appropriate assembly resolution event, to provide automatic assembly resolution for - /// an assembly and any of its dependencies. Depending on the target platform, this may include the use - /// of the .deps.json file generated during the build process. - /// - /// An object which, when disposed, un-subscribes. - public static IDisposable SubscribeResolveForAssembly(Type typeInAssembly, IMessageSink internalDiagnosticsMessageSink = null) - => null; - } -} - -#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/DependencyContextAssemblyCache.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/DependencyContextAssemblyCache.cs index 552844d3fbe..bc6d6068c2d 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/DependencyContextAssemblyCache.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/DependencyContextAssemblyCache.cs @@ -1,5 +1,3 @@ -#if NETCOREAPP - using System; using System.Collections.Generic; using System.IO; @@ -295,5 +293,3 @@ public string ResolveUnmanagedLibrary(string unmanagedLibraryName) } } } - -#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/ApplicationEnvironment.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/ApplicationEnvironment.cs index 7239a36cf61..74ed0624652 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/ApplicationEnvironment.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/ApplicationEnvironment.cs @@ -1,8 +1,6 @@ -// 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. -#if NETCOREAPP - using System; using System.IO; @@ -19,5 +17,3 @@ private static string GetApplicationBasePath() } } } - -#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContext.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContext.cs index 69aff6dbff8..83b34ac3da7 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContext.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContext.cs @@ -1,8 +1,6 @@ -// 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. -#if NETCOREAPP - using System; using System.Collections.Generic; using System.Linq; @@ -106,5 +104,3 @@ public int GetHashCode(T obj) } } } - -#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContextJsonReader.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContextJsonReader.cs index 104a12da2df..051cedbb192 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContextJsonReader.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContextJsonReader.cs @@ -1,8 +1,6 @@ -// 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. -#if NETCOREAPP - using System; using System.Collections.Generic; using System.IO; @@ -525,5 +523,3 @@ private struct LibraryStub } } } - -#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContextLoader.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContextLoader.cs index 57249dc7e92..d2ff1cccfc7 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContextLoader.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DependencyContextLoader.cs @@ -1,8 +1,6 @@ -// 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. -#if NETCOREAPP - using System; using System.Collections.Generic; using System.Diagnostics; @@ -128,5 +126,3 @@ private DependencyContext LoadAssemblyContext(Assembly assembly, IDependencyCont } } } - -#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IDependencyContextReader.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IDependencyContextReader.cs index 0a189a0b65e..2d5662eb382 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IDependencyContextReader.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IDependencyContextReader.cs @@ -1,5 +1,3 @@ -#if NETCOREAPP - using System; using System.IO; @@ -10,5 +8,3 @@ internal interface IDependencyContextReader: IDisposable DependencyContext Read(Stream stream); } } - -#endif diff --git a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/XunitPackageCompilationAssemblyResolver.cs b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/XunitPackageCompilationAssemblyResolver.cs index 01d4fe378b0..32974a0c190 100644 --- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/XunitPackageCompilationAssemblyResolver.cs +++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/XunitPackageCompilationAssemblyResolver.cs @@ -1,5 +1,3 @@ -#if NETCOREAPP - // Adapted from https://github.com/dotnet/core-setup/blob/652b680dff6b1afb9cd26cc3c2e883a664c209fd/src/managed/Microsoft.Extensions.DependencyModel/Resolution/PackageCompilationAssemblyResolver.cs using System; @@ -101,5 +99,3 @@ bool TryResolveFromPackagePath(CompilationLibrary library, string basePath, out } } } - -#endif diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Directory.Build.props b/src/Microsoft.DotNet.XUnitRunnerUap/Directory.Build.props deleted file mode 100644 index 0c98d167d19..00000000000 --- a/src/Microsoft.DotNet.XUnitRunnerUap/Directory.Build.props +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Directory.Build.targets b/src/Microsoft.DotNet.XUnitRunnerUap/Directory.Build.targets deleted file mode 100644 index 0c98d167d19..00000000000 --- a/src/Microsoft.DotNet.XUnitRunnerUap/Directory.Build.targets +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/Microsoft.DotNet.Uap.TestTools.sln b/src/Microsoft.DotNet.XUnitRunnerUap/Microsoft.DotNet.Uap.TestTools.sln deleted file mode 100644 index 8e39506cab5..00000000000 --- a/src/Microsoft.DotNet.XUnitRunnerUap/Microsoft.DotNet.Uap.TestTools.sln +++ /dev/null @@ -1,65 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28119.50 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsStoreAppLauncher", "Launcher\WindowsStoreAppLauncher.vcxproj", "{177AA879-D233-4A16-8398-8BDF5D5E1ED8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.XUnitRunnerUap", "src\Microsoft.DotNet.XUnitRunnerUap.csproj", "{552DECA2-68D7-4506-86DE-E808D1E60FB6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|ARM64 = Debug|ARM64 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|ARM64 = Release|ARM64 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Debug|ARM.ActiveCfg = Release|x64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Debug|ARM.Build.0 = Release|x64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Debug|ARM64.ActiveCfg = Release|ARM64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Debug|ARM64.Build.0 = Release|ARM64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Debug|x64.ActiveCfg = Release|x64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Debug|x64.Build.0 = Release|x64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Debug|x86.ActiveCfg = Release|Win32 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Debug|x86.Build.0 = Release|Win32 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Release|ARM.ActiveCfg = Release|Win32 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Release|ARM64.ActiveCfg = Release|ARM64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Release|ARM64.Build.0 = Release|ARM64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Release|x64.ActiveCfg = Release|x64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Release|x64.Build.0 = Release|x64 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Release|x86.ActiveCfg = Release|Win32 - {177AA879-D233-4A16-8398-8BDF5D5E1ED8}.Release|x86.Build.0 = Release|Win32 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|ARM.ActiveCfg = Debug|ARM - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|ARM.Build.0 = Debug|ARM - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|ARM.Deploy.0 = Debug|ARM - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|ARM64.Build.0 = Debug|ARM64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|x64.ActiveCfg = Debug|x64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|x64.Build.0 = Debug|x64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|x64.Deploy.0 = Debug|x64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|x86.ActiveCfg = Debug|x86 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|x86.Build.0 = Debug|x86 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Debug|x86.Deploy.0 = Debug|x86 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|ARM.ActiveCfg = Release|ARM - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|ARM.Build.0 = Release|ARM - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|ARM.Deploy.0 = Release|ARM - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|ARM64.ActiveCfg = Release|ARM64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|ARM64.Build.0 = Release|ARM64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|ARM64.Deploy.0 = Release|ARM64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|x64.ActiveCfg = Release|x64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|x64.Build.0 = Release|x64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|x64.Deploy.0 = Release|x64 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|x86.ActiveCfg = Release|x86 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|x86.Build.0 = Release|x86 - {552DECA2-68D7-4506-86DE-E808D1E60FB6}.Release|x86.Deploy.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/CommandLine.cs b/src/Microsoft.DotNet.XUnitRunnerUap/src/CommandLine.cs deleted file mode 100644 index cb363b7c34c..00000000000 --- a/src/Microsoft.DotNet.XUnitRunnerUap/src/CommandLine.cs +++ /dev/null @@ -1,323 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.IO; -using Xunit; - -namespace Microsoft.DotNet.XUnitRunnerUap -{ - internal class CommandLine - { - public enum ParallelismOption - { - none, - collections, - assemblies, - all - } - - private readonly Stack arguments = new Stack(); - - private CommandLine(string[] args, Predicate fileExists = null) - { - if (fileExists == null) - fileExists = File.Exists; - - for (var i = args.Length - 1; i >= 0; i--) - arguments.Push(args[i]); - - Project = Parse(fileExists); - } - - public bool Debug { get; protected set; } - - public bool DiagnosticMessages { get; protected set; } - - public bool FailSkips { get; protected set; } - - public int? MaxParallelThreads { get; set; } - - public bool NoColor { get; protected set; } - - public bool NoLogo { get; protected set; } - - public XunitProject Project { get; protected set; } - - public bool? ParallelizeAssemblies { get; protected set; } - - public bool? ParallelizeTestCollections { get; set; } - - public bool Serialize { get; protected set; } - - public bool Verbose { get; protected set; } - - public bool Wait { get; protected set; } - - public static CommandLine Parse(params string[] args) - { - return new CommandLine(args); - } - - protected virtual string GetFullPath(string fileName) - { - return Path.GetFullPath(fileName); - } - - XunitProject GetProjectFile(List> assemblies) - { - var result = new XunitProject(); - - foreach (var assembly in assemblies) - result.Add(new XunitProjectAssembly - { - AssemblyFilename = GetFullPath(assembly.Item1), - ConfigFilename = assembly.Item2 != null ? GetFullPath(assembly.Item2) : null, - }); - - return result; - } - - static void GuardNoOptionValue(KeyValuePair option) - { - if (option.Value != null) - throw new ArgumentException($"error: unknown command line option: {option.Value}"); - } - - static bool IsConfigFile(string fileName) - { - return fileName.EndsWith(".config", StringComparison.OrdinalIgnoreCase) - || fileName.EndsWith(".json", StringComparison.OrdinalIgnoreCase); - } - - protected XunitProject Parse(Predicate fileExists) - { - var assemblies = new List>(); - - while (arguments.Count > 0) - { - if (arguments.Peek().StartsWith("-", StringComparison.Ordinal)) - break; - - var assemblyFile = arguments.Pop(); - - string configFile = null; - if (arguments.Count > 0) - { - var value = arguments.Peek(); - if (!value.StartsWith("-", StringComparison.Ordinal) && IsConfigFile(value)) - { - configFile = arguments.Pop(); - if (!fileExists(configFile)) - throw new ArgumentException($"config file not found: {configFile}"); - } - } - - assemblies.Add(Tuple.Create(assemblyFile, configFile)); - } - - if (assemblies.Count == 0) - throw new ArgumentException("must specify at least one assembly"); - - var project = GetProjectFile(assemblies); - - while (arguments.Count > 0) - { - var option = PopOption(arguments); - var optionName = option.Key.ToLowerInvariant(); - - if (!optionName.StartsWith("-", StringComparison.Ordinal)) - throw new ArgumentException($"unknown command line option: {option.Key}"); - - optionName = optionName.Substring(1); - - if (optionName == "nologo") - { - GuardNoOptionValue(option); - NoLogo = true; - } - else if (optionName == "failskips") - { - GuardNoOptionValue(option); - FailSkips = true; - } - else if (optionName == "nocolor") - { - GuardNoOptionValue(option); - NoColor = true; - } - else if (optionName == "debug") - { - GuardNoOptionValue(option); - Debug = true; - } - else if (optionName == "serialize") - { - GuardNoOptionValue(option); - Serialize = true; - } - else if (optionName == "verbose") - { - GuardNoOptionValue(option); - Verbose = true; - } - else if (optionName == "wait") - { - GuardNoOptionValue(option); - Wait = true; - } - else if (optionName == "diagnostics") - { - GuardNoOptionValue(option); - DiagnosticMessages = true; - } - else if (optionName == "maxthreads") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -maxthreads"); - - switch (option.Value) - { - case "default": - MaxParallelThreads = 0; - break; - - case "unlimited": - MaxParallelThreads = -1; - break; - - default: - int threadValue; - if (!int.TryParse(option.Value, out threadValue) || threadValue < 1) - throw new ArgumentException("incorrect argument value for -maxthreads (must be 'default', 'unlimited', or a positive number)"); - - MaxParallelThreads = threadValue; - break; - } - } - else if (optionName == "parallel") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -parallel"); - - ParallelismOption parallelismOption; - if (!Enum.TryParse(option.Value, out parallelismOption)) - throw new ArgumentException("incorrect argument value for -parallel"); - - switch (parallelismOption) - { - case ParallelismOption.all: - ParallelizeAssemblies = true; - ParallelizeTestCollections = true; - break; - - case ParallelismOption.assemblies: - ParallelizeAssemblies = true; - ParallelizeTestCollections = false; - break; - - case ParallelismOption.collections: - ParallelizeAssemblies = false; - ParallelizeTestCollections = true; - break; - - default: - ParallelizeAssemblies = false; - ParallelizeTestCollections = false; - break; - } - } - else if (optionName == "trait") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -trait"); - - var pieces = option.Value.Split('='); - if (pieces.Length != 2 || string.IsNullOrEmpty(pieces[0]) || string.IsNullOrEmpty(pieces[1])) - throw new ArgumentException("incorrect argument format for -trait (should be \"name=value\")"); - - var name = pieces[0]; - var value = pieces[1]; - project.Filters.IncludedTraits.Add(name, value); - } - else if (optionName == "notrait") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -notrait"); - - var pieces = option.Value.Split('='); - if (pieces.Length != 2 || string.IsNullOrEmpty(pieces[0]) || string.IsNullOrEmpty(pieces[1])) - throw new ArgumentException("incorrect argument format for -notrait (should be \"name=value\")"); - - var name = pieces[0]; - var value = pieces[1]; - project.Filters.ExcludedTraits.Add(name, value); - } - else if (optionName == "class") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -class"); - - project.Filters.IncludedClasses.Add(option.Value); - } - else if (optionName == "noclass") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -noclass"); - - project.Filters.ExcludedClasses.Add(option.Value); - } - else if (optionName == "method") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -method"); - - project.Filters.IncludedMethods.Add(option.Value); - } - else if (optionName == "nomethod") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -nomethod"); - - project.Filters.ExcludedMethods.Add(option.Value); - } - else if (optionName == "namespace") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -namespace"); - - project.Filters.IncludedNamespaces.Add(option.Value); - } - else if (optionName == "nonamespace") - { - if (option.Value == null) - throw new ArgumentException("missing argument for -nonamespace"); - - project.Filters.ExcludedNamespaces.Add(option.Value); - } - else if (optionName == "xml") - { - if (option.Value == null) - throw new ArgumentException($"missing filename for {option.Key}"); - - project.Output.Add(optionName, option.Value); - } - } - - return project; - } - - static KeyValuePair PopOption(Stack arguments) - { - var option = arguments.Pop(); - string value = null; - - if (arguments.Count > 0 && !arguments.Peek().StartsWith("-", StringComparison.Ordinal)) - value = arguments.Pop(); - - return new KeyValuePair(option, value); - } - } -} diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/DictionaryExtensions.cs b/src/Microsoft.DotNet.XUnitRunnerUap/src/DictionaryExtensions.cs deleted file mode 100644 index ebfdd06f581..00000000000 --- a/src/Microsoft.DotNet.XUnitRunnerUap/src/DictionaryExtensions.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; - -namespace Microsoft.DotNet.XUnitRunnerUap -{ - internal static class DictionaryExtensions - { - public static void Add(this IDictionary> dictionary, TKey key, TValue value) - { - dictionary.GetOrAdd(key).Add(value); - } - - public static TValue GetOrAdd(this IDictionary dictionary, TKey key) - where TValue : new() - { - return dictionary.GetOrAdd(key, () => new TValue()); - } - - public static TValue GetOrAdd(this IDictionary dictionary, TKey key, Func newValue) - { - if (!dictionary.TryGetValue(key, out TValue result)) - { - result = newValue(); - dictionary[key] = result; - } - - return result; - } - } -} diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/Program.cs b/src/Microsoft.DotNet.XUnitRunnerUap/src/Program.cs deleted file mode 100644 index 6c0ada7b0af..00000000000 --- a/src/Microsoft.DotNet.XUnitRunnerUap/src/Program.cs +++ /dev/null @@ -1,240 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Concurrent; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Threading.Tasks; -using System.Xml.Linq; -using Windows.Storage; -using Xunit; - -namespace Microsoft.DotNet.XUnitRunnerUap -{ - class Program - { - volatile static bool cancel = false; - - static int Main(string[] args) - { - // Handle RemoteExecutor - if (args.Length > 0 && args[0] == "remote") - { - return RemoteExecutor.Execute(args.Skip(1).ToArray()); - } - - if (args.Length == 0 || args[0] == "-?" || args[0] == "/?" || args[0] == "-h" || args[0] == "--help") - { - PrintHeader(); - PrintUsage(); - return 2; - } - - var commandLine = CommandLine.Parse(args); - - Console.CancelKeyPress += (sender, e) => - { - if (!cancel) - { - Console.WriteLine("Canceling... (Press Ctrl+C again to terminate)"); - cancel = true; - e.Cancel = true; - } - }; - - if (commandLine.Debug) - { - Debugger.Launch(); - } - - if (!commandLine.NoLogo) - PrintHeader(); - - var completionMessages = new ConcurrentDictionary(); - var assembliesElement = new XElement("assemblies"); - - int errorCount = 0; - int failCount = 0; - - foreach (var assembly in commandLine.Project.Assemblies) - { - if (cancel) - { - break; - } - - assembly.Configuration.PreEnumerateTheories = false; - assembly.Configuration.DiagnosticMessages |= commandLine.DiagnosticMessages; - assembly.Configuration.AppDomain = AppDomainSupport.Denied; - var discoveryOptions = TestFrameworkOptions.ForDiscovery(assembly.Configuration); - var executionOptions = TestFrameworkOptions.ForExecution(assembly.Configuration); - executionOptions.SetDisableParallelization(true); - - try - { - using (var xunit = new XunitFrontController(AppDomainSupport.Denied, assembly.AssemblyFilename, assembly.ConfigFilename, assembly.Configuration.ShadowCopyOrDefault)) - using (var discoveryVisitor = new TestDiscoveryVisitor()) - { - string assemblyName = Path.GetFileNameWithoutExtension(assembly.AssemblyFilename); - // Discover & filter the tests - Console.WriteLine($"Discovering: {assemblyName}"); - xunit.Find(false, discoveryVisitor, discoveryOptions); - discoveryVisitor.Finished.WaitOne(); - - var testCasesDiscovered = discoveryVisitor.TestCases.Count; - var filteredTestCases = discoveryVisitor.TestCases.Where(commandLine.Project.Filters.Filter).ToList(); - var testCasesToRun = filteredTestCases.Count; - - Console.WriteLine($"Discovered: {assemblyName}"); - - // Run the filtered tests - if (testCasesToRun == 0) - { - Console.WriteLine($"Info: {assemblyName} has no tests to run"); - } - else - { - if (commandLine.Serialize) - { - filteredTestCases = filteredTestCases.Select(xunit.Serialize).Select(xunit.Deserialize).ToList(); - } - - var assemblyElement = new XElement("assembly"); - - StandardUapVisitor resultsVisitor = new StandardUapVisitor(assemblyElement, () => cancel, completionMessages, commandLine.Verbose, commandLine.FailSkips); - - xunit.RunTests(filteredTestCases, resultsVisitor, executionOptions); - - resultsVisitor.Finished.WaitOne(); - - assembliesElement.Add(assemblyElement); - - // Set counters to determine the error code later. - errorCount += resultsVisitor.ExecutionSummary.Errors; - failCount += resultsVisitor.ExecutionSummary.Failed; - - Console.WriteLine($"{Path.GetFileNameWithoutExtension(assembly.AssemblyFilename)} Total: {resultsVisitor.ExecutionSummary.Total}, Errors: {resultsVisitor.ExecutionSummary.Errors}, Failed: {resultsVisitor.ExecutionSummary.Failed}, Skipped: {resultsVisitor.ExecutionSummary.Skipped}, Time: {resultsVisitor.ExecutionSummary.Time}"); - } - } - } - catch (Exception ex) - { - assembliesElement = new XElement("error"); - assembliesElement.Add(ex); - - if (!commandLine.NoColor) - Console.ForegroundColor = ConsoleColor.Red; - - Console.WriteLine($"error: {ex.Message}"); - - if (commandLine.DiagnosticMessages) - { - if (!commandLine.NoColor) - Console.ForegroundColor = ConsoleColor.DarkGray; - - Console.WriteLine(ex.StackTrace); - } - } - finally - { - if (!commandLine.NoColor) - Console.ResetColor(); - - WriteResults(Path.GetFileName(assembly.AssemblyFilename), assembliesElement).GetAwaiter().GetResult(); - } - } - - if (cancel) - return -1073741510; // 0xC000013A: The application terminated as a result of a CTRL+C - - if (commandLine.Wait) - { - Console.WriteLine(); - Console.Write("Press any key to continue..."); - Console.ReadKey(); - Console.WriteLine(); - } - - if (errorCount > 0 || failCount > 0) - return 1; - - return 0; - } - - static async Task WriteResults(string test, XElement data) - { - StorageFolder folder = await KnownFolders.DocumentsLibrary.CreateFolderAsync("TestResults", CreationCollisionOption.OpenIfExists); - StorageFile file = await folder.CreateFileAsync(test + ".xml", CreationCollisionOption.ReplaceExisting); - - using (var stream = await file.OpenStreamForWriteAsync()) - { - data.Save(stream); - stream.Flush(); - } - } - - private static void PrintHeader() - { - var platform = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; - var versionAttribute = typeof(Program).Assembly.GetCustomAttribute(); - - Console.WriteLine($"xUnit.net Console Runner v1.0.25 ({IntPtr.Size * 8}-bit {platform})"); - } - - private static void PrintUsage() - { - var executableName = "XUnitRunnerUap"; - - Console.WriteLine("Copyright (C) .NET Foundation."); - Console.WriteLine(); - Console.WriteLine($"usage: {executableName} [options]"); - Console.WriteLine(); - Console.WriteLine("Valid options:"); - Console.WriteLine(" -nologo : do not show the copyright message"); - Console.WriteLine(" -nocolor : do not output results with colors"); - Console.WriteLine(" -failskips : convert skipped tests into failures"); - Console.WriteLine(" -parallel option : set parallelization based on option"); - Console.WriteLine(" : none - turn off all parallelization"); - Console.WriteLine(" : collections - only parallelize collections"); - Console.WriteLine(" : assemblies - only parallelize assemblies"); - Console.WriteLine(" : all - parallelize assemblies & collections"); - Console.WriteLine(" -maxthreads count : maximum thread count for collection parallelization"); - Console.WriteLine(" : default - run with default (1 thread per CPU thread)"); - Console.WriteLine(" : unlimited - run with unbounded thread count"); - Console.WriteLine(" : (number) - limit task thread pool size to 'count'"); - Console.WriteLine(" -wait : wait for input after completion"); - Console.WriteLine(" -diagnostics : enable diagnostics messages for all test assemblies"); - Console.WriteLine(" -debug : launch the debugger to debug the tests"); - Console.WriteLine(" -serialize : serialize all test cases (for diagnostic purposes only)"); - Console.WriteLine(" -verbose : enable verbose messages (track start and finish time)"); - Console.WriteLine(" -trait \"name=value\" : only run tests with matching name/value traits"); - Console.WriteLine(" : if specified more than once, acts as an OR operation"); - Console.WriteLine(" -notrait \"name=value\" : do not run tests with matching name/value traits"); - Console.WriteLine(" : if specified more than once, acts as an AND operation"); - Console.WriteLine(" -method \"name\" : run a given test method (can be fully specified or use a wildcard;"); - Console.WriteLine(" : i.e., 'MyNamespace.MyClass.MyTestMethod' or '*.MyTestMethod')"); - Console.WriteLine(" : if specified more than once, acts as an OR operation"); - Console.WriteLine(" -nomethod \"name\" : do not run a given test method (can be fully specified or use a wildcard;"); - Console.WriteLine(" : i.e., 'MyNamespace.MyClass.MyTestMethod' or '*.MyTestMethod')"); - Console.WriteLine(" : if specified more than once, acts as an AND operation"); - Console.WriteLine(" -class \"name\" : run all methods in a given test class (should be fully"); - Console.WriteLine(" : specified; i.e., 'MyNamespace.MyClass')"); - Console.WriteLine(" : if specified more than once, acts as an OR operation"); - Console.WriteLine(" -noclass \"name\" : do not run any methods in a given test class (should be fully"); - Console.WriteLine(" : specified; i.e., 'MyNamespace.MyClass')"); - Console.WriteLine(" : if specified more than once, acts as an AND operation"); - Console.WriteLine(" -namespace \"name\" : run all methods in a given namespace (i.e.,"); - Console.WriteLine(" : 'MyNamespace.MySubNamespace')"); - Console.WriteLine(" : if specified more than once, acts as an OR operation"); - Console.WriteLine(" -nonamespace \"name\" : do not run any methods in a given namespace (i.e.,"); - Console.WriteLine(" : 'MyNamespace.MySubNamespace')"); - Console.WriteLine(" : if specified more than once, acts as an AND operation"); - Console.WriteLine(" -xml \"name\" : The xml test results file name"); - Console.WriteLine(); - } - } -} diff --git a/src/Microsoft.DotNet.XUnitRunnerUap/src/StandardUapVisitor.cs b/src/Microsoft.DotNet.XUnitRunnerUap/src/StandardUapVisitor.cs deleted file mode 100644 index 5af2dd709eb..00000000000 --- a/src/Microsoft.DotNet.XUnitRunnerUap/src/StandardUapVisitor.cs +++ /dev/null @@ -1,187 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Concurrent; -using System.IO; -using System.Xml.Linq; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.DotNet.XUnitRunnerUap -{ - internal class StandardUapVisitor : XmlTestExecutionVisitor - { - private string _assemblyName; - private readonly ConcurrentDictionary _completionMessages; - private readonly bool _verbose; - private readonly bool _failSkips; - - public StandardUapVisitor(XElement assemblyElement, Func cancelThunk, - ConcurrentDictionary completionMessages, bool verbose, bool failSkips) - : base(assemblyElement, cancelThunk) - { - _completionMessages = completionMessages; - _verbose = verbose; - _failSkips = failSkips; - } - - public ExecutionSummary ExecutionSummary - { - get - { - if (_completionMessages.TryGetValue(_assemblyName, out ExecutionSummary summary)) - { - return summary; - } - - return new ExecutionSummary(); - } - } - - protected override bool Visit(ITestAssemblyStarting assemblyStarting) - { - _assemblyName = Path.GetFileNameWithoutExtension(assemblyStarting.TestAssembly.Assembly.AssemblyPath); - - Console.WriteLine($"Starting: {_assemblyName}"); - - return base.Visit(assemblyStarting); - } - - protected override bool Visit(ITestAssemblyFinished assemblyFinished) - { - // Base class does computation of results, so call it first. - var result = base.Visit(assemblyFinished); - - Console.WriteLine($"Finished: {_assemblyName}"); - - _completionMessages.TryAdd(_assemblyName, new ExecutionSummary - { - Total = assemblyFinished.TestsRun, - Failed = !_failSkips ? assemblyFinished.TestsFailed : assemblyFinished.TestsFailed + assemblyFinished.TestsSkipped, - Skipped = !_failSkips ? assemblyFinished.TestsSkipped : 0, - Time = assemblyFinished.ExecutionTime, - Errors = Errors - }); - - return result; - } - - protected override bool Visit(ITestFailed testFailed) - { - Console.WriteLine($" {XmlEscape(testFailed.Test.DisplayName)} [FAIL]"); - Console.WriteLine($" {ExceptionUtility.CombineMessages(testFailed).Replace(Environment.NewLine, Environment.NewLine + " ")}"); - - WriteStackTrace(ExceptionUtility.CombineStackTraces(testFailed)); - - return base.Visit(testFailed); - } - - protected override bool Visit(ITestPassed testPassed) - { - return base.Visit(testPassed); - } - - protected override bool Visit(ITestSkipped testSkipped) - { - if (_failSkips) - { - return Visit(new TestFailed(testSkipped.Test, 0M, "", new[] { "FAIL_SKIP" }, new[] { testSkipped.Reason }, new[] { "" }, new[] { -1 })); - } - - Console.WriteLine($" {XmlEscape(testSkipped.Test.DisplayName)} [SKIP]"); - Console.WriteLine($" {XmlEscape(testSkipped.Reason)}"); - - return base.Visit(testSkipped); - } - - protected override bool Visit(ITestStarting testStarting) - { - if (_verbose) - { - Console.WriteLine($" {XmlEscape(testStarting.Test.DisplayName)} [STARTING]"); - } - return base.Visit(testStarting); - } - - protected override bool Visit(ITestFinished testFinished) - { - if (_verbose) - { - Console.WriteLine($" {XmlEscape(testFinished.Test.DisplayName)} [FINISHED] Time: {testFinished.ExecutionTime}s"); - } - return base.Visit(testFinished); - } - - protected override bool Visit(IErrorMessage error) - { - WriteError("FATAL", error); - - return base.Visit(error); - } - - protected override bool Visit(ITestAssemblyCleanupFailure cleanupFailure) - { - WriteError($"Test Assembly Cleanup Failure ({cleanupFailure.TestAssembly.Assembly.AssemblyPath})", cleanupFailure); - - return base.Visit(cleanupFailure); - } - - protected override bool Visit(ITestCaseCleanupFailure cleanupFailure) - { - WriteError($"Test Case Cleanup Failure ({cleanupFailure.TestCase.DisplayName})", cleanupFailure); - - return base.Visit(cleanupFailure); - } - - protected override bool Visit(ITestClassCleanupFailure cleanupFailure) - { - WriteError($"Test Class Cleanup Failure ({cleanupFailure.TestClass.Class.Name})", cleanupFailure); - - return base.Visit(cleanupFailure); - } - - protected override bool Visit(ITestCollectionCleanupFailure cleanupFailure) - { - WriteError($"Test Collection Cleanup Failure ({cleanupFailure.TestCollection.DisplayName})", cleanupFailure); - - return base.Visit(cleanupFailure); - } - - protected override bool Visit(ITestCleanupFailure cleanupFailure) - { - WriteError($"Test Cleanup Failure ({cleanupFailure.Test.DisplayName})", cleanupFailure); - - return base.Visit(cleanupFailure); - } - - protected override bool Visit(ITestMethodCleanupFailure cleanupFailure) - { - WriteError($"Test Method Cleanup Failure ({cleanupFailure.TestMethod.Method.Name})", cleanupFailure); - - return base.Visit(cleanupFailure); - } - - protected void WriteError(string failureName, IFailureInformation failureInfo) - { - Console.WriteLine($" [{failureName}] {XmlEscape(failureInfo.ExceptionTypes[0])}"); - Console.WriteLine($" {XmlEscape(ExceptionUtility.CombineMessages(failureInfo))}"); - - WriteStackTrace(ExceptionUtility.CombineStackTraces(failureInfo)); - } - - void WriteStackTrace(string stackTrace) - { - if (string.IsNullOrWhiteSpace(stackTrace)) - return; - - Console.WriteLine(" Stack Trace:"); - - foreach (var stackFrame in stackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.None)) - { - Console.WriteLine($" {StackFrameTransformer.TransformFrame(stackFrame, Directory.GetCurrentDirectory())}"); - } - } - } -}