diff --git a/.gitignore b/.gitignore index ded1afeca3..9523d94f87 100644 --- a/.gitignore +++ b/.gitignore @@ -132,3 +132,8 @@ src/package/sign/sign.nuget.targets # Vscode files # =========================== .vscode/ + +# =========================== +# diag log files +# =========================== +logs/ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index afcd052d01..5d90790b86 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,13 +63,25 @@ jobs: testResultsFormat: VSTest testResultsFiles: '**\*.trx' condition: succeededOrFailed() - -- job: Linux + +- job: + workspace: + clean: all + strategy: + matrix: + Ubuntu_18_04: + vmImage: ubuntu-18.04 + pwsh: true + macOS_10_15_Catalina: + vmImage: macOS-10.15 + pwsh: true pool: - vmImage: 'ubuntu-18.04' + vmImage: $[ variables['vmImage'] ] variables: buildConfiguration: 'Release' steps: - script: ./build.sh -c $(buildConfiguration) displayName: './build.sh -c $(buildConfiguration)' + - script: ./test.sh -c $(buildConfiguration) + displayName: './test.sh -c $(buildConfiguration)' diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 1133f769f8..bed8cb90d8 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -226,36 +226,6 @@ function Restore-Package & $dotnetExe restore $env:TP_ROOT_DIR\src\package\external\external.csproj --packages $env:TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version Write-Log ".. .. Restore-Package: Complete." - # Fixing a problem with procdump package - # $procdumpFolder = "$env:TP_PACKAGES_DIR\procdump\0.0.1" - # if (-not (Test-Path "$procdumpFolder\bin") -and -not $CIBuild) - # { - # Add-Type -AssemblyName System.IO.Compression.FileSystem - - # $zip = $null - # try { - # $zip = [System.IO.Compression.ZipFile]::Open("$procdumpFolder\procdump.0.0.1.nupkg", 0) - # $zip.Entries | Where-Object { $_.FullName.StartsWith("bin/") } | ForEach-Object { - # $file = "$procdumpFolder\$($_.FullName)" - # $fi = [System.IO.Path]::GetDirectoryName($file) - # if (-not (Test-Path $fi)) { - # New-Item -Type Directory -Path $fi -Force - # } - - # if (-not (Test-Path $file)) { - # [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $file, $true) - # } - # } - # } - # finally - # { - # if ($null -ne $zip) - # { - # $zip.Dispose() - # } - # } - # } - Set-ScriptFailedOnError Write-Log "Restore-Package: Complete. {$(Get-ElapsedTime($timer))}" @@ -404,20 +374,26 @@ function Publish-Package # Copy the .NET core x86 and x64 testhost exes from tempPublish to required folder New-Item -ItemType directory -Path $testhostCore20PackageX64Dir -Force | Out-Null - Copy-Item $testhostCore20PackageTempX64Dir\testhost* $testhostCore20PackageX64Dir -Force -recurse + Copy-Item $testhostCore20PackageTempX64Dir\testhost* $testhostCore20PackageX64Dir -Force -Recurse + Copy-Item $testhostCore20PackageTempX64Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore20PackageX64Dir -Force + New-Item -ItemType directory -Path $testhostCore20PackageX86Dir -Force | Out-Null - Copy-Item $testhostCore20PackageTempX86Dir\testhost.x86* $testhostCore20PackageX86Dir -Force -recurse + Copy-Item $testhostCore20PackageTempX86Dir\testhost.x86* $testhostCore20PackageX86Dir -Force -Recurse + Copy-Item $testhostCore20PackageTempX86Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore20PackageX86Dir -Force New-Item -ItemType directory -Path $testhostCore10PackageX64Dir -Force | Out-Null - Copy-Item $testhostCore10PackageTempX64Dir\testhost* $testhostCore10PackageX64Dir -Force -recurse + Copy-Item $testhostCore10PackageTempX64Dir\testhost* $testhostCore10PackageX64Dir -Force -Recurse + Copy-Item $testhostCore20PackageTempX64Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore10PackageX64Dir -Force + New-Item -ItemType directory -Path $testhostCore10PackageX86Dir -Force | Out-Null - Copy-Item $testhostCore10PackageTempX86Dir\testhost.x86* $testhostCore10PackageX86Dir -Force -recurse + Copy-Item $testhostCore10PackageTempX86Dir\testhost.x86* $testhostCore10PackageX86Dir -Force -Recurse + Copy-Item $testhostCore10PackageTempX86Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore10PackageX86Dir -Force # Copy over the Full CLR built testhost package assemblies to the Core CLR and Full CLR package folder. $coreCLRFull_Dir = "TestHost" $fullDestDir = Join-Path $coreCLR20PackageDir $coreCLRFull_Dir New-Item -ItemType directory -Path $fullDestDir -Force | Out-Null - Copy-Item $testhostFullPackageDir\* $fullDestDir -Force -recurse + Copy-Item $testhostFullPackageDir\* $fullDestDir -Force -Recurse Set-ScriptFailedOnError @@ -425,7 +401,7 @@ function Publish-Package Publish-PackageInternal $dataCollectorProject $TPB_TargetFramework472 $fullDestDir New-Item -ItemType directory -Path $fullCLRPackage451Dir -Force | Out-Null - Copy-Item $testhostFullPackageDir\* $fullCLRPackage451Dir -Force -recurse + Copy-Item $testhostFullPackageDir\* $fullCLRPackage451Dir -Force -Recurse Set-ScriptFailedOnError diff --git a/scripts/build/TestPlatform.Dependencies.props b/scripts/build/TestPlatform.Dependencies.props index ed4fe3e21c..9fe91f412c 100644 --- a/scripts/build/TestPlatform.Dependencies.props +++ b/scripts/build/TestPlatform.Dependencies.props @@ -32,7 +32,7 @@ 9.0.1 4.7.63 16.9.0-preview-4189539 - 16.9.0-beta.20552.5 + 16.9.0-beta.20563.1 16.8.0-beta.20420.2 16.0.461 diff --git a/scripts/test.sh b/scripts/test.sh index d4a7b3f0bf..7c0ded1dc3 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -48,7 +48,7 @@ done # # Variables # -PROJECT_NAME_PATTERNS=**Unit*bin*$CONFIGURATION*netcoreapp1.0*UnitTests*dll +PROJECT_NAME_PATTERNS=**Unit*bin*$CONFIGURATION*netcoreapp2.1*UnitTests*dll TP_ROOT_DIR=$(cd "$(dirname "$0")"; pwd -P) TP_TOOLS_DIR="$TP_ROOT_DIR/tools" TP_PACKAGES_DIR="$TP_ROOT_DIR/packages" @@ -67,7 +67,7 @@ DOTNET_CLI_VERSION="latest" # Build configuration # TPB_Solution="TestPlatform.sln" -TPB_TargetFrameworkCore="netcoreapp2.0" +TPB_TargetFrameworkCore="netcoreapp2.1" TPB_Configuration=$CONFIGURATION TPB_TargetRuntime=$TARGET_RUNTIME TPB_Verbose=$VERBOSE @@ -111,7 +111,7 @@ function invoke_test() local dotnet=$(_get_dotnet_path) local vstest=$TP_OUT_DIR/$TPB_Configuration/$TPB_TargetFrameworkCore/vstest.console.dll - find ./test -path $PROJECT_NAME_PATTERNS | xargs --verbose $dotnet $vstest --parallel + find ./test -path $PROJECT_NAME_PATTERNS | xargs $dotnet $vstest --parallel --testcasefilter:"TestCategory!=Windows" } # @@ -119,7 +119,7 @@ function invoke_test() # _get_dotnet_path() { - echo "$TP_TOOLS_DIR/dotnet/dotnet" + echo "$TP_TOOLS_DIR/dotnet-linux/dotnet" } invoke_test diff --git a/scripts/verify-nupkgs.ps1 b/scripts/verify-nupkgs.ps1 index 196c02546f..55402d48a8 100644 --- a/scripts/verify-nupkgs.ps1 +++ b/scripts/verify-nupkgs.ps1 @@ -12,7 +12,7 @@ function Verify-Nuget-Packages($packageDirectory) { Write-Log "Starting Verify-Nuget-Packages." $expectedNumOfFiles = @{ - "Microsoft.CodeCoverage" = 43; + "Microsoft.CodeCoverage" = 44; "Microsoft.NET.Test.Sdk" = 18; "Microsoft.TestPlatform" = 488; "Microsoft.TestPlatform.Build" = 19; @@ -20,7 +20,7 @@ function Verify-Nuget-Packages($packageDirectory) "Microsoft.TestPlatform.Extensions.TrxLogger" = 33; "Microsoft.TestPlatform.ObjectModel" = 178; "Microsoft.TestPlatform.Portable" = 566; - "Microsoft.TestPlatform.TestHost" = 213; + "Microsoft.TestPlatform.TestHost" = 212; "Microsoft.TestPlatform.TranslationLayer" = 121} $nugetPackages = Get-ChildItem -Filter "*.nupkg" $packageDirectory | % { $_.FullName} diff --git a/scripts/verify-sign.ps1 b/scripts/verify-sign.ps1 index 3d351e9037..6a3673da07 100644 --- a/scripts/verify-sign.ps1 +++ b/scripts/verify-sign.ps1 @@ -70,6 +70,10 @@ function Verify-Assemblies elseif ($signature.SignerCertificate.Thumbprint -eq "899FA016DEE8E665FF2A315A1151C43FB96C430B") { Write-Log "Valid (Prod Signed): $($_.FullName)." } + # Microsoft 3rd Party Application Component + elseif ($signature.SignerCertificate.Thumbprint -eq "709133ECC53CBF386F4A5ECB782AEEF499F0F8CA") { + Write-Log "Valid (Prod Signed): $($_.FullName)." + } else { Write-FailLog "Incorrect certificate. File: $($_.FullName). Certificate: $($signature.SignerCertificate.Thumbprint)." } diff --git a/src/DataCollectors/TraceDataCollector/VanguardCollector/DynamicCoverageDataCollector.cs b/src/DataCollectors/TraceDataCollector/VanguardCollector/DynamicCoverageDataCollector.cs index e5e4e94cb0..6f499016c4 100644 --- a/src/DataCollectors/TraceDataCollector/VanguardCollector/DynamicCoverageDataCollector.cs +++ b/src/DataCollectors/TraceDataCollector/VanguardCollector/DynamicCoverageDataCollector.cs @@ -51,9 +51,13 @@ public class DynamicCoverageDataCollector : BaseDataCollector private const string ClrIeDisableCodeSignatureValidationVariable = @"MicrosoftInstrumentationEngine_DisableCodeSignatureValidation"; private const string ClrieFileLogPathVariable = @"MicrosoftInstrumentationEngine_FileLogPath"; + private const string InjectDotnetAdditionalDepsSettingName = "InjectDotnetAdditionalDeps"; + private const string VanguardDotnetAdditionalDepsVariable = "VANGUARD_DOTNET_ADDITIONAL_DEPS"; + private readonly IEnvironment environment; private bool useClrIeInstrumentationForNetCore; private bool useClrIeInstrumentationForNetFramework; + private bool injectDotnetAdditionalDeps; /// /// Data collector implementation @@ -116,6 +120,7 @@ protected override void OnInitialize(XmlElement configurationElement) { this.useClrIeInstrumentationForNetCore = IsClrInstrumentationEnabled(configurationElement, ClrIeInstrumentationForNetCoreSettingName, ClrIeInstrumentationForNetCoreVariable); this.useClrIeInstrumentationForNetFramework = IsClrInstrumentationEnabled(configurationElement, ClrIeInstrumentationForNetFrameworkSettingName, ClrIeInstrumentationForNetFrameworkVariable); + this.injectDotnetAdditionalDeps = GetConfigurationValue(configurationElement, InjectDotnetAdditionalDepsSettingName) ?? true; this.implementation.Initialize(configurationElement, this.DataSink, this.Logger); this.Events.SessionStart += this.SessionStart; @@ -177,6 +182,11 @@ protected override IEnumerable> GetEnvironmentVaria envVaribles.Add(new KeyValuePair(ClrieFileLogPathVariable, Path.Combine(Path.GetTempPath(), this.implementation.GetSessionName(), Guid.NewGuid() + ".log"))); } + if (this.injectDotnetAdditionalDeps && !string.IsNullOrEmpty(this.implementation.CodeCoverageDepsJsonFilePath)) + { + envVaribles.Add(new KeyValuePair(VanguardDotnetAdditionalDepsVariable, this.implementation.CodeCoverageDepsJsonFilePath)); + } + if (EqtTrace.IsInfoEnabled) { EqtTrace.Info("DynamicCoverageDataCollector.GetEnvironmentVariables: Returning following environment variables: {0}", string.Join(",", envVaribles)); @@ -194,10 +204,9 @@ protected override IEnumerable> GetEnvironmentVaria /// If CLR IE should be enabled private static bool IsClrInstrumentationEnabled(XmlElement configurationElement, string configurationSettingName, string environmentVariableName) { - XmlElement configurationSetting = configurationElement != null ? configurationElement[configurationSettingName] : null; - string configurationSettingValue = configurationSetting != null ? configurationSetting.InnerText : null; + var clrInstrumentationEnabledByConfiguration = GetConfigurationValue(configurationElement, configurationSettingName); - if (bool.TryParse(configurationSettingValue, out var clrInstrumentationEnabled) && clrInstrumentationEnabled) + if (clrInstrumentationEnabledByConfiguration == true) { return true; } @@ -211,6 +220,22 @@ private static bool IsClrInstrumentationEnabled(XmlElement configurationElement, return int.TryParse(environmentVariableValue, out var environmentVariableIntValue) && environmentVariableIntValue > 0; } + /// + /// Check flag in configuration + /// + /// Configuration + /// Configuration setting name + /// Flag value in configuration. Null if not present. + private static bool? GetConfigurationValue(XmlElement configurationElement, string configurationSettingName) + { + if (bool.TryParse(configurationElement?[configurationSettingName]?.InnerText, out var settingValue)) + { + return settingValue; + } + + return null; + } + /// /// On session end /// diff --git a/src/DataCollectors/TraceDataCollector/VanguardCollector/DynamicCoverageDataCollectorImpl.cs b/src/DataCollectors/TraceDataCollector/VanguardCollector/DynamicCoverageDataCollectorImpl.cs index 6d0e0b56ee..5803d0a954 100644 --- a/src/DataCollectors/TraceDataCollector/VanguardCollector/DynamicCoverageDataCollectorImpl.cs +++ b/src/DataCollectors/TraceDataCollector/VanguardCollector/DynamicCoverageDataCollectorImpl.cs @@ -33,35 +33,70 @@ internal class DynamicCoverageDataCollectorImpl : IDynamicCoverageDataCollectorI /// private const string VanguardConfigFileName = "CodeCoverage.config"; + /// + /// File name of deps.json file with reference to Microsoft.VisualStudio.CodeCoverage.Shim.dll. + /// + private const string CodeCoverageDepsJsonFileName = "CodeCoverage.deps.json"; + /// /// Name of element for custom coverage filename. /// private const string CoverageFileSettingName = "CoverageFileName"; + private const string CodeCoverageDepsJsonTemplate = @" +{{ + ""runtimeTarget"": {{ + ""name"": ""codecoverage"", + ""signature"": """" + }}, + ""targets"": {{ + ""codecoverage"": {{ + ""Microsoft.VisualStudio.CodeCoverage.Shim/15.0.0.0"": {{ + ""runtime"": {{ + ""{0}"": {{ }} + }} + }} + }} + }}, + ""libraries"": {{ + ""Microsoft.VisualStudio.CodeCoverage.Shim/15.0.0.0"": {{ + ""type"": ""reference"", + ""serviceable"": false, + ""sha512"": """" + }} + }} +}} +"; + /// - /// Coverage file name + /// Directory helper /// - private string coverageFileName; + private readonly IDirectoryHelper directoryHelper; /// - /// Logger + /// Profilers location provider /// - private IDataCollectionLogger logger; + private readonly IProfilersLocationProvider profilersLocationProvider; /// - /// Data sink + /// File helper /// - private TraceCollector.IDataCollectionSink dataSink; + private readonly IFileHelper fileHelper; /// - /// Directory helper + /// Coverage file name /// - private IDirectoryHelper directoryHelper; + private string coverageFileName; /// - /// File helper + /// Logger + /// + private IDataCollectionLogger logger; + + /// + /// Data sink /// - private IFileHelper fileHelper; + private TraceCollector.IDataCollectionSink dataSink; /// /// Folder to store temporary files @@ -71,17 +106,23 @@ internal class DynamicCoverageDataCollectorImpl : IDynamicCoverageDataCollectorI private string coverageFilePath; public DynamicCoverageDataCollectorImpl() - : this(new Vanguard(), new DirectoryHelper(), new FileHelper()) + : this(new Vanguard(), new DirectoryHelper(), new FileHelper(), new ProfilersLocationProvider()) { } - internal DynamicCoverageDataCollectorImpl(IVanguard vanguard, IDirectoryHelper directoryHelper, IFileHelper fileHelper) + internal DynamicCoverageDataCollectorImpl(IVanguard vanguard, IDirectoryHelper directoryHelper, IFileHelper fileHelper, IProfilersLocationProvider profilersLocationProvider) { this.Vanguard = vanguard; this.directoryHelper = directoryHelper; this.fileHelper = fileHelper; + this.profilersLocationProvider = profilersLocationProvider; } + /// + /// Gets path to deps.json file with reference to Microsoft.VisualStudio.CodeCoverage.Shim.dll. + /// + public string CodeCoverageDepsJsonFilePath { get; private set; } + /// /// Gets or sets session name /// @@ -295,9 +336,12 @@ private void PrepareVanguardProcess(XmlElement configurationElement) ?? DynamicCoverageDataCollectorImpl.GetDefaultConfiguration()[ConfigCodeCoverageElementName]; string configurationFileName = Path.Combine(this.sessionDirectory, VanguardConfigFileName); - this.fileHelper.WriteAllText(configurationFileName, config.OuterXml); + this.CodeCoverageDepsJsonFilePath = Path.Combine(this.sessionDirectory, CodeCoverageDepsJsonFileName); + var codeCoverageDepsJsonContent = this.profilersLocationProvider.GetCodeCoverageShimPath()?.Replace(@"\", "/"); + this.fileHelper.WriteAllText(this.CodeCoverageDepsJsonFilePath, string.Format(CodeCoverageDepsJsonTemplate, codeCoverageDepsJsonContent)); + EqtTrace.Info("DynamicCoverageDataCollectorImpl.PrepareVanguardProcess: Initializing with config: {0}.", config.OuterXml); this.Vanguard.Initialize(this.SessionName, configurationFileName, this.logger); } diff --git a/src/DataCollectors/TraceDataCollector/VanguardCollector/Interfaces/IDynamicCoverageDataCollectorImpl.cs b/src/DataCollectors/TraceDataCollector/VanguardCollector/Interfaces/IDynamicCoverageDataCollectorImpl.cs index ef5f53ff70..c87ff56b2a 100644 --- a/src/DataCollectors/TraceDataCollector/VanguardCollector/Interfaces/IDynamicCoverageDataCollectorImpl.cs +++ b/src/DataCollectors/TraceDataCollector/VanguardCollector/Interfaces/IDynamicCoverageDataCollectorImpl.cs @@ -14,6 +14,8 @@ namespace Microsoft.VisualStudio.Coverage.Interfaces /// internal interface IDynamicCoverageDataCollectorImpl : IDisposable { + string CodeCoverageDepsJsonFilePath { get; } + string GetSessionName(); void Initialize( diff --git a/src/DataCollectors/TraceDataCollector/VanguardCollector/Interfaces/IProfilersLocationProvider.cs b/src/DataCollectors/TraceDataCollector/VanguardCollector/Interfaces/IProfilersLocationProvider.cs index e86d933236..6ca0fb672f 100644 --- a/src/DataCollectors/TraceDataCollector/VanguardCollector/Interfaces/IProfilersLocationProvider.cs +++ b/src/DataCollectors/TraceDataCollector/VanguardCollector/Interfaces/IProfilersLocationProvider.cs @@ -49,5 +49,11 @@ internal interface IProfilersLocationProvider /// /// x64 CLR IE Path string GetClrInstrumentationEngineX64Path(); + + /// + /// Get path to Microsoft.VisualStudio.CodeCoverage.Shim library + /// + /// Path to Microsoft.VisualStudio.CodeCoverage.Shim library + string GetCodeCoverageShimPath(); } } \ No newline at end of file diff --git a/src/DataCollectors/TraceDataCollector/VanguardCollector/ProfilersLocationProvider.cs b/src/DataCollectors/TraceDataCollector/VanguardCollector/ProfilersLocationProvider.cs index 636e8f330e..ce6230879a 100644 --- a/src/DataCollectors/TraceDataCollector/VanguardCollector/ProfilersLocationProvider.cs +++ b/src/DataCollectors/TraceDataCollector/VanguardCollector/ProfilersLocationProvider.cs @@ -22,6 +22,7 @@ internal class ProfilersLocationProvider : IProfilersLocationProvider private const string VanguardX64ProfilerPath = @"amd64\covrun64.dll"; private const string VanguardX86ProfilerConfigPath = @"VanguardInstrumentationProfiler_x86.config"; private const string VanguardX64ProfilerConfigPath = @"amd64\VanguardInstrumentationProfiler_x64.config"; + private const string VanguardShimPath = @"coreclr\Microsoft.VisualStudio.CodeCoverage.Shim.dll"; /// /// Vanguard executable name @@ -76,6 +77,12 @@ public string GetClrInstrumentationEngineX64Path() return this.GetClrInstrumentationEnginePath("x64", ClrIeX64FileName, ClrIeX64InstallDirVariable); } + /// + public string GetCodeCoverageShimPath() + { + return Path.Combine(this.GetVanguardDirectory(), VanguardShimPath); + } + private string GetClrInstrumentationEnginePath(string arch, string fileName, string environmentVariableName) { var installationPath = Environment.GetEnvironmentVariable(environmentVariableName); diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.cs.xlf index 5436e4ca79..7bc4d376db 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.cs.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - Testovací běh pro: {0}({1}) + Testovací běh pro {0} ({1}) diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.de.xlf index 61d4e2dd35..c04090a249 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.de.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - Testlauf für "{0}" ({1}) + Testlauf für "{0}" ({1}) diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.es.xlf index 83186e7077..25034b6cd5 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.es.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - Serie de pruebas para {0}({1}) + Serie de pruebas para {0} ({1}) diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.fr.xlf index 19f6a092a2..1593ef23b8 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.fr.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - Série de tests pour {0}({1}) + Série de tests pour {0} ({1}) diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.it.xlf index 3a91eab678..05c0ee99cd 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.it.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - Esecuzione dei test per {0}({1}) + Esecuzione dei test per {0} ({1}) diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ja.xlf index 3a9e5d0e6c..c15bf9ae7f 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ja.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - {0}({1}) のテスト実行 + {0} ({1}) のテスト実行 diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ko.xlf index 64998a2d4b..77c6f97d70 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ko.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - {0}({1})에 대한 테스트 실행 + {0}({1})에 대한 테스트 실행 diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pl.xlf index 2f1a0547d0..7b7f7aad39 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pl.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - Przebieg testu dla: {0}({1}) + Przebieg testu dla: {0} ({1}) diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pt-BR.xlf index 7a01f64e8d..a5567bbf43 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pt-BR.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - Execução de teste para {0}({1}) + Execução de teste para {0} ({1}) diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ru.xlf index ec259d8377..8a1d1a7427 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ru.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - Тестовый запуск {0}({1}) + Тестовый запуск для {0} ({1}) diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hans.xlf index ab3adf93fd..f0bdf3c164 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hans.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - {0} 的测试运行({1}) + {0} ({1})的测试运行 diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hant.xlf index 7d3b92e6d4..0fe930f5b6 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hant.xlf @@ -32,7 +32,7 @@ Test run for {0} ({1}) - {0}({1}) 的測試回合 + {0} 的測試回合 ({1}) diff --git a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs index 6b16b27a55..565cf31578 100644 --- a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs +++ b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs @@ -22,9 +22,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.DesignMode using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; - using CommunicationUtilitiesResources = Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources; - using CoreUtilitiesConstants = Microsoft.VisualStudio.TestPlatform.CoreUtilities.Constants; - using ObjectModelConstants = Microsoft.VisualStudio.TestPlatform.ObjectModel.Constants; + using CommunicationUtilitiesResources = CommunicationUtilities.Resources.Resources; /// /// The design mode client. @@ -114,7 +112,7 @@ public void ConnectToClientAndProcessRequests(int port, ITestRequestManager test string.Format( CultureInfo.CurrentUICulture, CommunicationUtilitiesResources.ConnectionTimeoutErrorMessage, - CoreUtilitiesConstants.VstestConsoleProcessName, + CoreUtilities.Constants.VstestConsoleProcessName, "translation layer", connectionTimeoutInSecs, EnvironmentHelper.VstestConnectionTimeout) @@ -324,7 +322,7 @@ public bool AttachDebuggerToProcess(int pid, CancellationToken cancellationToken // If an attach request is issued but there is no support for attaching on the other // side of the communication channel, we simply return and let the caller know the // request failed. - if (this.protocolConfig.Version < ObjectModelConstants.MinimumProtocolVersionWithDebugSupport) + if (this.protocolConfig.Version < Constants.MinimumProtocolVersionWithDebugSupport) { return false; } @@ -413,39 +411,39 @@ public void TestRunMessageHandler(object sender, TestRunMessageEventArgs e) private void StartTestRun(TestRunRequestPayload testRunPayload, ITestRequestManager testRequestManager, bool skipTestHostLaunch) { Task.Run( - delegate - { - try + () => { - testRequestManager.ResetOptions(); - - var customLauncher = skipTestHostLaunch ? - DesignModeTestHostLauncherFactory.GetCustomHostLauncherForTestRun(this, testRunPayload) : null; + try + { + testRequestManager.ResetOptions(); - testRequestManager.RunTests(testRunPayload, customLauncher, new DesignModeTestEventsRegistrar(this), this.protocolConfig); - } - catch (Exception ex) - { - EqtTrace.Error("DesignModeClient: Exception in StartTestRun: " + ex); + var customLauncher = skipTestHostLaunch ? + DesignModeTestHostLauncherFactory.GetCustomHostLauncherForTestRun(this, testRunPayload) : null; - var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = ex.ToString() }; - this.communicationManager.SendMessage(MessageType.TestMessage, testMessagePayload); - var runCompletePayload = new TestRunCompletePayload() + testRequestManager.RunTests(testRunPayload, customLauncher, new DesignModeTestEventsRegistrar(this), this.protocolConfig); + } + catch (Exception ex) { - TestRunCompleteArgs = new TestRunCompleteEventArgs(null, false, true, ex, null, TimeSpan.MinValue), - LastRunTests = null - }; + EqtTrace.Error("DesignModeClient: Exception in StartTestRun: " + ex); - // Send run complete to translation layer - this.communicationManager.SendMessage(MessageType.ExecutionComplete, runCompletePayload); - } - }); + var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = ex.ToString() }; + this.communicationManager.SendMessage(MessageType.TestMessage, testMessagePayload); + var runCompletePayload = new TestRunCompletePayload() + { + TestRunCompleteArgs = new TestRunCompleteEventArgs(null, false, true, ex, null, TimeSpan.MinValue), + LastRunTests = null + }; + + // Send run complete to translation layer + this.communicationManager.SendMessage(MessageType.ExecutionComplete, runCompletePayload); + } + }); } private void StartDiscovery(DiscoveryRequestPayload discoveryRequestPayload, ITestRequestManager testRequestManager) { Task.Run( - delegate + () => { try { @@ -475,7 +473,7 @@ private void StartDiscovery(DiscoveryRequestPayload discoveryRequestPayload, ITe private void StartTestRunAttachmentsProcessing(TestRunAttachmentsProcessingPayload attachmentsProcessingPayload, ITestRequestManager testRequestManager) { Task.Run( - delegate + () => { try { diff --git a/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs b/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs index cf01e11821..be17ec3f34 100644 --- a/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs +++ b/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs @@ -395,8 +395,9 @@ public void HandleRawMessage(string rawMessage) { // Note: Deserialize rawMessage only if required. - var message = this.LoggerManager.LoggersInitialized || this.requestData.IsTelemetryOptedIn ? - this.dataSerializer.DeserializeMessage(rawMessage) : null; + var message = this.LoggerManager.LoggersInitialized || this.requestData.IsTelemetryOptedIn + ? this.dataSerializer.DeserializeMessage(rawMessage) + : null; if (string.Equals(message?.MessageType, MessageType.DiscoveryComplete)) { diff --git a/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs b/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs index fdce95cde3..35c9b0082a 100644 --- a/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs +++ b/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs @@ -40,12 +40,12 @@ public class TestRunRequest : ITestRunRequest, ITestRunEventsHandler2 /// /// Sync object for various operations /// - private object syncObject = new Object(); + private object syncObject = new object(); /// /// Sync object for cancel operation /// - private object cancelSyncObject = new Object(); + private object cancelSyncObject = new object(); /// /// The run completion event which will be signaled on completion of test run. @@ -190,12 +190,12 @@ internal void OnTestSessionTimeout(object obj) { if (EqtTrace.IsVerboseEnabled) { - EqtTrace.Verbose(String.Format("TestRunRequest.OnTestSessionTimeout: calling cancellation as test run exceeded testSessionTimeout {0} milliseconds", testSessionTimeout)); + EqtTrace.Verbose(string.Format("TestRunRequest.OnTestSessionTimeout: calling cancellation as test run exceeded testSessionTimeout {0} milliseconds", testSessionTimeout)); } - string message = String.Format(ClientResources.TestSessionTimeoutMessage, this.testSessionTimeout); - var testMessagePayload = new CommunicationObjectModel.TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = message }; - var rawMessage = this.dataSerializer.SerializePayload(CommunicationObjectModel.MessageType.TestMessage, testMessagePayload); + string message = string.Format(ClientResources.TestSessionTimeoutMessage, this.testSessionTimeout); + var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = message }; + var rawMessage = this.dataSerializer.SerializePayload(MessageType.TestMessage, testMessagePayload); this.HandleLogMessage(TestMessageLevel.Error, message); this.HandleRawMessage(rawMessage); @@ -215,7 +215,7 @@ public bool WaitForCompletion(int timeout) } if (this.State != TestRunState.InProgress - && !(this.State == TestRunState.Completed + && !(this.State == TestRunState.Completed || this.State == TestRunState.Canceled || this.State == TestRunState.Aborted)) { diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 8687b79276..8a24a51a4f 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -26,7 +26,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Client using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; - using ClientResources = Microsoft.VisualStudio.TestPlatform.Client.Resources.Resources; + using ClientResources = Resources.Resources; /// /// Implementation for TestPlatform @@ -136,7 +136,7 @@ public ITestRunRequest CreateTestRunRequest(IRequestData requestData, TestRunCri var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(testRunCriteria.TestRunSettings); // Update extension assemblies from source when design mode is false. - if (runConfiguration.DesignMode == false) + if (!runConfiguration.DesignMode) { this.AddExtensionAssembliesFromSource(testRunCriteria); } @@ -176,8 +176,7 @@ public void Dispose() /// Skips filtering by name (if true). public void UpdateExtensions(IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) { - this.TestEngine.GetExtensionManager() - .UseAdditionalExtensions(pathToAdditionalExtensions, skipExtensionFilters); + this.TestEngine.GetExtensionManager().UseAdditionalExtensions(pathToAdditionalExtensions, skipExtensionFilters); } /// @@ -192,11 +191,8 @@ private void ThrowExceptionIfTestHostManagerIsNull(ITestRuntimeProvider testHost { if (testHostManager == null) { - var config = XmlRunSettingsUtilities.GetRunConfigurationNode(settingXml); - var framework = config.TargetFramework; - EqtTrace.Error("TestPlatform.CreateTestRunRequest: No suitable testHostProvider found for runsettings : {0}", settingXml); - throw new TestPlatformException(String.Format(CultureInfo.CurrentCulture, ClientResources.NoTestHostProviderFound)); + throw new TestPlatformException(string.Format(CultureInfo.CurrentCulture, ClientResources.NoTestHostProviderFound)); } } diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionAttachmentManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionAttachmentManager.cs index 6938babef3..953c79974c 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionAttachmentManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionAttachmentManager.cs @@ -62,7 +62,7 @@ internal class DataCollectionAttachmentManager : IDataCollectionAttachmentManage /// Initializes a new instance of the class. /// public DataCollectionAttachmentManager() - : this(new Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.FileHelper()) + : this(new TestPlatform.Utilities.Helpers.FileHelper()) { } @@ -336,10 +336,7 @@ private void AddNewFileTransfer(FileTransferInformation fileTransferInfo, AsyncC } } - if (sendFileCompletedCallback != null) - { - sendFileCompletedCallback(this, new AsyncCompletedEventArgs(t.Exception, false, fileTransferInfo.UserToken)); - } + sendFileCompletedCallback?.Invoke(this, new AsyncCompletedEventArgs(t.Exception, false, fileTransferInfo.UserToken)); } catch (Exception e) { diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs index 74378d5fd7..de25804357 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs @@ -59,7 +59,7 @@ public override string IdentifierData } /// - public override ICollection Metadata + public override ICollection Metadata { get { @@ -130,7 +130,7 @@ private static object[] GetAttributes(Type dataCollectorType, Type attributeType // If any attribute constructor on the type throws, the exception will bubble up through // the "GetCustomAttributes" method. - return dataCollectorType.GetTypeInfo().GetCustomAttributes(attributeType, true).ToArray(); + return dataCollectorType.GetTypeInfo().GetCustomAttributes(attributeType, true).ToArray(); } } } diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionEvents.cs b/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionEvents.cs index adb1265374..63a08d96c5 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionEvents.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionEvents.cs @@ -76,7 +76,7 @@ internal TestPlatformDataCollectionEvents() /// internal void RaiseEvent(DataCollectionEventArgs e) { - ValidateArg.NotNull(e, "DataCollectionEventArgs"); + ValidateArg.NotNull(e, "DataCollectionEventArgs"); EventInvoker onEvent; diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/LazyExtension.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/LazyExtension.cs index 61a78b164f..76cfd71a4b 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/LazyExtension.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/LazyExtension.cs @@ -36,12 +36,12 @@ public LazyExtension(TExtension instance, TMetadata metadata) { if (instance == null) { - throw new ArgumentNullException("instance"); ; + throw new ArgumentNullException("instance"); } if (metadata == null) { - throw new ArgumentNullException("instance"); ; + throw new ArgumentNullException("instance"); } this.extension = instance; @@ -58,12 +58,12 @@ public LazyExtension(TestPluginInformation pluginInfo, Type metadataType) { if (pluginInfo == null) { - throw new ArgumentNullException("pluginInfo"); ; + throw new ArgumentNullException("pluginInfo"); } if (metadataType == null) { - throw new ArgumentNullException("metadataType"); ; + throw new ArgumentNullException("metadataType"); } this.testPluginInfo = pluginInfo; @@ -80,12 +80,12 @@ public LazyExtension(TestPluginInformation pluginInfo, TMetadata metadata) { if (pluginInfo == null) { - throw new ArgumentNullException("pluginInfo"); ; + throw new ArgumentNullException("pluginInfo"); } if (metadata == null) { - throw new ArgumentNullException("metadata"); ; + throw new ArgumentNullException("metadata"); } this.testPluginInfo = pluginInfo; @@ -102,12 +102,12 @@ public LazyExtension(Func creator, TMetadata metadata) { if (creator == null) { - throw new ArgumentNullException("creator"); ; + throw new ArgumentNullException("creator"); } if (metadata == null) { - throw new ArgumentNullException("metadata"); ; + throw new ArgumentNullException("metadata"); } this.extensionCreator = creator; diff --git a/src/Microsoft.TestPlatform.Common/Filtering/Condition.cs b/src/Microsoft.TestPlatform.Common/Filtering/Condition.cs index 6eb059fab0..1020100988 100644 --- a/src/Microsoft.TestPlatform.Common/Filtering/Condition.cs +++ b/src/Microsoft.TestPlatform.Common/Filtering/Condition.cs @@ -93,7 +93,7 @@ internal Condition(string name, Operation operation, string value) /// /// Evaluate this condition for testObject. /// - internal bool Evaluate(Func propertyValueProvider) + internal bool Evaluate(Func propertyValueProvider) { ValidateArg.NotNull(propertyValueProvider, nameof(propertyValueProvider)); var result = false; @@ -217,7 +217,7 @@ private static void ThrownFormatExceptionForInvalidCondition(string conditionStr /// /// Check if condition validates any property in properties. /// - internal bool ValidForProperties(IEnumerable properties, Func propertyProvider) + internal bool ValidForProperties(IEnumerable properties, Func propertyProvider) { bool valid = false; diff --git a/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs b/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs index ef5fb5c23c..df529eb0ba 100644 --- a/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs +++ b/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs @@ -277,7 +277,7 @@ internal static FilterExpression Parse(string filterString, out FastFilter fastF /// /// The property Value Provider. /// True if evaluation is successful. - internal bool Evaluate(Func propertyValueProvider) + internal bool Evaluate(Func propertyValueProvider) { ValidateArg.NotNull(propertyValueProvider, nameof(propertyValueProvider)); diff --git a/src/Microsoft.TestPlatform.Common/Friends.cs b/src/Microsoft.TestPlatform.Common/Friends.cs index 950f802108..e767fb98ad 100644 --- a/src/Microsoft.TestPlatform.Common/Friends.cs +++ b/src/Microsoft.TestPlatform.Common/Friends.cs @@ -23,5 +23,6 @@ [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CommunicationUtilities.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Client.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("Microsoft.TestPlatform.TestUtilities, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] #endregion \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs b/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs index 26bbcef7d1..13a3416be7 100644 --- a/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs +++ b/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs @@ -197,7 +197,7 @@ internal void WaitForEventCompletion() /// Arguments to to be raised. internal void RaiseTestResult(TestResultEventArgs args) { - ValidateArg.NotNull(args, "args"); + ValidateArg.NotNull(args, "args"); this.CheckDisposed(); @@ -217,7 +217,7 @@ internal void RaiseTestResult(TestResultEventArgs args) /// Arguments to be raised. internal void RaiseTestRunStart(TestRunStartEventArgs args) { - ValidateArg.NotNull(args, "args"); + ValidateArg.NotNull(args, "args"); CheckDisposed(); @@ -230,7 +230,7 @@ internal void RaiseTestRunStart(TestRunStartEventArgs args) /// Arguments to be raised. internal void RaiseDiscoveryStart(DiscoveryStartEventArgs args) { - ValidateArg.NotNull(args, "args"); + ValidateArg.NotNull(args, "args"); CheckDisposed(); @@ -243,7 +243,7 @@ internal void RaiseDiscoveryStart(DiscoveryStartEventArgs args) /// Arguments to be raised. internal void RaiseDiscoveryMessage(TestRunMessageEventArgs args) { - ValidateArg.NotNull(args, "args"); + ValidateArg.NotNull(args, "args"); this.CheckDisposed(); @@ -257,7 +257,7 @@ internal void RaiseDiscoveryMessage(TestRunMessageEventArgs args) /// Arguments to be raised. internal void RaiseDiscoveredTests(DiscoveredTestsEventArgs args) { - ValidateArg.NotNull(args, "args"); + ValidateArg.NotNull(args, "args"); CheckDisposed(); @@ -270,7 +270,7 @@ internal void RaiseDiscoveredTests(DiscoveredTestsEventArgs args) /// Arguments to be raised. internal void RaiseDiscoveryComplete(DiscoveryCompleteEventArgs args) { - ValidateArg.NotNull(args, "args"); + ValidateArg.NotNull(args, "args"); CheckDisposed(); @@ -287,7 +287,7 @@ internal void RaiseDiscoveryComplete(DiscoveryCompleteEventArgs args) /// Arguments to be raised internal void RaiseTestRunComplete(TestRunCompleteEventArgs args) { - ValidateArg.NotNull(args, "args"); + ValidateArg.NotNull(args, "args"); CheckDisposed(); @@ -341,8 +341,8 @@ private void TestRunMessageHandler(object sender, TestRunMessageEventArgs e) /// private void SafeInvokeAsync(Func eventHandlersFactory, EventArgs args, int size, string traceDisplayName) { - ValidateArg.NotNull>(eventHandlersFactory, "eventHandlersFactory"); - ValidateArg.NotNull(args, "args"); + ValidateArg.NotNull(eventHandlersFactory, "eventHandlersFactory"); + ValidateArg.NotNull(args, "args"); // Invoke the handlers on a background thread. this.loggerEventQueue.QueueJob( @@ -428,9 +428,9 @@ private static int FindTestResultSize(TestResultEventArgs args) if (args.Result.Messages.Count != 0) { - foreach (ObjectModel.TestResultMessage msg in args.Result.Messages) + foreach (TestResultMessage msg in args.Result.Messages) { - if (!String.IsNullOrEmpty(msg.Text)) + if (!string.IsNullOrEmpty(msg.Text)) size += msg.Text.Length; } } diff --git a/src/Microsoft.TestPlatform.Common/RunSettings.cs b/src/Microsoft.TestPlatform.Common/RunSettings.cs index cc86218fe0..53bc86612a 100644 --- a/src/Microsoft.TestPlatform.Common/RunSettings.cs +++ b/src/Microsoft.TestPlatform.Common/RunSettings.cs @@ -208,8 +208,8 @@ private void ReadRunSettings(XmlReader reader) [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "This methods must not fail on crash in loading settings.")] private void LoadSection(XmlReader reader, SettingsProviderExtensionManager settingsExtensionManager) { - ValidateArg.NotNull(reader, "reader"); - ValidateArg.NotNull(settingsExtensionManager, "settingsExtensionManager"); + ValidateArg.NotNull(reader, "reader"); + ValidateArg.NotNull(settingsExtensionManager, "settingsExtensionManager"); // Check for duplicate settings if (this.settings.ContainsKey(reader.Name)) diff --git a/src/Microsoft.TestPlatform.Common/SettingsProvider/SettingsProviderExtensionManager.cs b/src/Microsoft.TestPlatform.Common/SettingsProvider/SettingsProviderExtensionManager.cs index 7f7335a5ea..372b7f3660 100644 --- a/src/Microsoft.TestPlatform.Common/SettingsProvider/SettingsProviderExtensionManager.cs +++ b/src/Microsoft.TestPlatform.Common/SettingsProvider/SettingsProviderExtensionManager.cs @@ -145,7 +145,7 @@ public static void Destroy() /// Indicates whether this method should throw on error. public static void LoadAndInitializeAllExtensions(bool shouldThrowOnError) { - var extensionManager = SettingsProviderExtensionManager.Create(); + var extensionManager = Create(); try { diff --git a/src/Microsoft.TestPlatform.Common/Utilities/ExceptionUtilities.cs b/src/Microsoft.TestPlatform.Common/Utilities/ExceptionUtilities.cs index 3284d15a3c..43d0e4f027 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/ExceptionUtilities.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/ExceptionUtilities.cs @@ -4,6 +4,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.Utilities { using System; + using System.Text; /// /// Exception utilities. @@ -22,15 +23,16 @@ public static string GetExceptionMessage(Exception exception) return string.Empty; } - var exceptionString = exception.Message; + var exceptionString = new StringBuilder(exception.Message); var inner = exception.InnerException; while (inner != null) { - exceptionString += Environment.NewLine + inner.Message; + exceptionString.Append(Environment.NewLine); + exceptionString.Append(inner.Message); inner = inner.InnerException; } - return exceptionString; + return exceptionString.ToString(); } } } diff --git a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs index c6e981289d..9caf3d38d1 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs @@ -83,7 +83,7 @@ public static void UpdateRunSettingsNode(this IRunSettingsProvider runSettingsPr ValidateArg.NotNull(data, nameof(data)); var xmlDocument = runSettingsProvider.GetRunSettingXmlDocument(); - RunSettingsProviderExtensions.UpdateRunSettingsXmlDocument(xmlDocument, key, data); + UpdateRunSettingsXmlDocument(xmlDocument, key, data); runSettingsProvider.UpdateRunSettings(xmlDocument.OuterXml); } @@ -149,7 +149,7 @@ public static void UpdateRunSettingsNodeInnerXml(this IRunSettingsProvider runSe ValidateArg.NotNull(xml, nameof(xml)); var xmlDocument = runSettingsProvider.GetRunSettingXmlDocument(); - RunSettingsProviderExtensions.UpdateRunSettingsXmlDocumentInnerXml(xmlDocument, key, xml); + UpdateRunSettingsXmlDocumentInnerXml(xmlDocument, key, xml); runSettingsProvider.UpdateRunSettings(xmlDocument.OuterXml); } @@ -172,7 +172,7 @@ internal static XmlNode GetXmlNode(XmlDocument xmlDocument, string key) internal static void UpdateRunSettingsXmlDocument(XmlDocument xmlDocument, string key, string data) { - var node = GetXmlNode(xmlDocument, key) ?? RunSettingsProviderExtensions.CreateNode(xmlDocument, key); + var node = GetXmlNode(xmlDocument, key) ?? CreateNode(xmlDocument, key); node.InnerText = data; } diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/EnvironmentHelper.cs b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/EnvironmentHelper.cs index 41e631b246..032d9c1275 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/EnvironmentHelper.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/EnvironmentHelper.cs @@ -21,16 +21,16 @@ public static int GetConnectionTimeout() #if NETSTANDARD1_0 var envVarValue = string.Empty; #else - var envVarValue = Environment.GetEnvironmentVariable(EnvironmentHelper.VstestConnectionTimeout); + var envVarValue = Environment.GetEnvironmentVariable(VstestConnectionTimeout); #endif if (!string.IsNullOrEmpty(envVarValue) && int.TryParse(envVarValue, out int value) && value >= 0) { - EqtTrace.Info("EnvironmentHelper.GetConnectionTimeout: {0} value set to {1}.", EnvironmentHelper.VstestConnectionTimeout, value); + EqtTrace.Info("EnvironmentHelper.GetConnectionTimeout: {0} value set to {1}.", VstestConnectionTimeout, value); } else { - value = EnvironmentHelper.DefaultConnectionTimeout; + value = DefaultConnectionTimeout; } return value; diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs index 6cf218d7ad..bfe4bb4dcd 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs @@ -117,8 +117,8 @@ public void DeleteEmptyDirectroy(string dirPath) { try { - if (Directory.Exists(dirPath) && Directory.GetFiles(dirPath).Length == 0 - && Directory.GetDirectories(dirPath).Length == 0) + if (Directory.Exists(dirPath) + && Directory.EnumerateFileSystemEntries(dirPath).Count() == 0) { Directory.Delete(dirPath, true); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestLoggerManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestLoggerManager.cs index 616f48d165..80c8c6fcd4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestLoggerManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestLoggerManager.cs @@ -658,20 +658,5 @@ private void CheckDisposed() throw new ObjectDisposedException(typeof(TestLoggerManager).FullName); } } - - /// - /// Check and raise warning if disposed. - /// - /// Warning message. - /// TestLoggerManager disposed flag. - private bool CheckAndRaiseWarningIfDisposed(string warning) - { - if (this.isDisposed) - { - EqtTrace.Warning("{0}: Ignoring as the object is disposed.", warning); - } - - return this.isDisposed; - } } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionTestRunEventsHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionTestRunEventsHandler.cs index 8a7025fe82..74682d4b74 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionTestRunEventsHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionTestRunEventsHandler.cs @@ -130,7 +130,7 @@ public void HandleTestRunComplete(TestRunCompleteEventArgs testRunCompleteArgs, { if (this.dataCollectionAttachmentSets != null && this.dataCollectionAttachmentSets.Any()) { - runContextAttachments = DataCollectionTestRunEventsHandler.GetCombinedAttachmentSets(this.dataCollectionAttachmentSets, runContextAttachments); + runContextAttachments = GetCombinedAttachmentSets(this.dataCollectionAttachmentSets, runContextAttachments); } this.testRunEventsHandler.HandleTestRunComplete(testRunCompleteArgs, lastChunkArgs, runContextAttachments, executorUris); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyOutOfProcDataCollectionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyOutOfProcDataCollectionManager.cs index 094c371e2c..b10e7193fe 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyOutOfProcDataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyOutOfProcDataCollectionManager.cs @@ -24,7 +24,7 @@ internal class ProxyOutOfProcDataCollectionManager /// /// Sync object for ensuring that only run is active at a time /// - private Object syncObject = new Object(); + private object syncObject = new object(); /// /// Initializes a new instance of the class. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs index 0d440e5bdd..9de75faa79 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs @@ -241,7 +241,7 @@ private void DiscoverTestsFromSingleDiscoverer( EqtTrace.Verbose("DiscovererEnumerator.DiscoverTestsFromSingleDiscoverer: Done loading tests for {0}", discoverer.Value.GetType().FullName); - var discovererFromDeprecatedLocations = DiscovererEnumerator.IsDiscovererFromDeprecatedLocations(discoverer); + var discovererFromDeprecatedLocations = IsDiscovererFromDeprecatedLocations(discoverer); if (discovererFromDeprecatedLocations) { logger.SendMessage(TestMessageLevel.Warning, diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs index 15a0295aa4..35d3cf319f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs @@ -581,7 +581,7 @@ private TestExecutorExtensionManager GetExecutorExtensionManager(string extensio try { if (string.IsNullOrEmpty(extensionAssembly) - || string.Equals(extensionAssembly, ObjectModel.Constants.UnspecifiedAdapterPath)) + || string.Equals(extensionAssembly, Constants.UnspecifiedAdapterPath)) { // full execution. Since the extension manager is cached this can be created multiple times without harming performance. return TestExecutorExtensionManager.Create(); @@ -729,7 +729,7 @@ private ICollection UpdateTestResults(ICollection testRe foreach (var testResult in testResults) { - var updatedTestResult = this.dataSerializer.Clone(testResult); + var updatedTestResult = this.dataSerializer.Clone(testResult); updatedTestResult.TestCase.Source = package; updatedTestResults.Add(updatedTestResult); } @@ -747,7 +747,7 @@ private ICollection UpdateInProgressTests(ICollection inProg ICollection updatedTestCases = new List(); foreach (var inProgressTestCase in inProgressTestCases) { - var updatedTestCase = this.dataSerializer.Clone(inProgressTestCase); + var updatedTestCase = this.dataSerializer.Clone(inProgressTestCase); updatedTestCase.Source = package; updatedTestCases.Add(updatedTestCase); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs index ae85f23f1e..d0cd36ce80 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs @@ -106,7 +106,7 @@ public void StartTestRun( } catch (Exception e) { - runEventsHandler.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Error, e.ToString()); + runEventsHandler.HandleLogMessage(TestMessageLevel.Error, e.ToString()); this.Abort(runEventsHandler); } finally @@ -142,7 +142,7 @@ public void StartTestRun( } catch (Exception e) { - runEventsHandler.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Error, e.ToString()); + runEventsHandler.HandleLogMessage(TestMessageLevel.Error, e.ToString()); this.Abort(runEventsHandler); } finally diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithSources.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithSources.cs index 377cac355c..d77952a2c3 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithSources.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithSources.cs @@ -22,7 +22,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution using ObjectModel.Client; using ObjectModel.Logging; using Utilities; - using CrossPlatEngineResources = Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources; + using CrossPlatEngineResources = Resources.Resources; internal class RunTestsWithSources : BaseRunTests { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs index 79990b4b19..b072cac0a0 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs @@ -129,7 +129,7 @@ private Dictionary, List> GetExecutorVsTestCaseList // TODO: Fill this in with the right extension value. var executorUriExtensionTuple = new Tuple( test.ExecutorUri, - ObjectModel.Constants.UnspecifiedAdapterPath); + Constants.UnspecifiedAdapterPath); if (result.TryGetValue(executorUriExtensionTuple, out testList)) { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf index 3ee87a2759..872c937c60 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf @@ -194,7 +194,7 @@ Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/master/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - Wyszukiwanie adaptera jest zmieniane, zobacz https://github.com/Microsoft/vstest-docs/blob/master/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmapw celu uzyskania dalszych szczegółów. + Wyszukiwanie adaptera jest zmieniane, zobacz https://github.com/Microsoft/vstest-docs/blob/master/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap w celu uzyskania dalszych szczegółów. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index fa6364b08f..0f9f6e8118 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -80,7 +80,7 @@ public IProxyDiscoveryManager GetDiscoveryManager(IRequestData requestData, ITes return new InProcessProxyDiscoveryManager(testHostManager, new TestHostManagerFactory(newRequestData)); } - Func proxyDiscoveryManagerCreator = delegate + Func proxyDiscoveryManagerCreator = () => { var hostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(discoveryCriteria.RunSettings); hostManager?.Initialize(TestSessionMessageLogger.Instance, discoveryCriteria.RunSettings); @@ -120,7 +120,7 @@ public IProxyExecutionManager GetExecutionManager(IRequestData requestData, ITes } // SetupChannel ProxyExecutionManager with data collection if data collectors are specififed in run settings. - Func proxyExecutionManagerCreator = delegate + Func proxyExecutionManagerCreator = () => { // Create a new HostManager, to be associated with individual ProxyExecutionManager(&POM) var hostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(testRunCriteria.TestRunSettings); @@ -178,8 +178,8 @@ private static int GetDistinctNumberOfSources(TestRunCriteria testRunCriteria) int numSources = 1; if (testRunCriteria.HasSpecificTests) { - numSources = new System.Collections.Generic.HashSet( - testRunCriteria.Tests.Select((testCase) => testCase.Source)).Count; + numSources = new HashSet( + testRunCriteria.Tests.Select(testCase => testCase.Source)).Count; } else { diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.cs.xlf index e70ff548d3..92cbf0b875 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.cs.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - Aktivní testovací běh byl přerušen, protože hostitelský proces byl neočekávaně ukončen při provádění následujících testů: + Aktivní testovací běh se přerušil, protože proces hostitele se neočekávaně ukončil. Prověřte prosím výše zásobník volání, pokud je k dispozici. Nabídne vám další informace o původu výjimky. +Test, který běžel, když došlo k chybovému ukončení: +{0} +Tento test může a nemusí být příčinou chybového ukončení. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - Uplynul zadaný čas nečinnosti {0} min. Shromažďuje se výpis paměti a ukončuje se proces hostitele testu. + Zadaná doba nečinnosti {0} {1} vypršela. Shromažďují se výpisy při zablokování z hostitele testhost a jeho podřízených procesů. {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + Všechny testy se dokončily. Soubor sekvence se nevygeneruje. "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + Vytváří se výpis pro {0} – {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + Vytváří se výpis tohoto stromu procesu (zespod) minutes - minutes + minuty seconds - seconds + sekundy diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.de.xlf index a1235bf501..3a269fc2c5 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.de.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - Der aktive Testlauf wurde abgebrochen, weil der Hostprozess beim Ausführen der folgenden Tests unerwartet beendet wurde: + Der aktive Testlauf wurde abgebrochen, weil der Hostprozess unerwartet beendet wurde. Überprüfen Sie die oben aufgeführte Aufrufliste, falls verfügbar, um weitere Informationen zur Ursache der Ausnahme zu erhalten. +Beim Absturz ausgeführter Test: +{0} +Dieser Test kann, muss aber nicht unbedingt die Absturzursache sein. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - Die angegebene Inaktivitätszeit von {0} Minuten ist abgelaufen. Ein Speicherabbild wird erfasst, und der Testhostprozess wird beendet. + Die angegebene Inaktivitätszeit von {0} {1} ist abgelaufen. Vom Testhost und den untergeordneten Prozessen werden Stillstandsicherungen erfasst. {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + Alle Tests wurden ausgeführt. Die Datei "Sequence" wird nicht generiert. "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + "{1}" ({0}) wird gesichert. as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + Diese Prozessstruktur wird gesichert (von unten). minutes - minutes + Minuten seconds - seconds + Sekunden diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.es.xlf index 2774c34d0f..f70b011c51 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.es.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - La serie de pruebas activa se anuló porque el proceso del host se cerró inesperadamente al ejecutar las pruebas siguientes: + La serie de pruebas activa se anuló porque el proceso de host se cerró de forma inesperada. Compruebe la pila de llamadas anterior, si está disponible, para obtener más información sobre el origen de la excepción. +Prueba en ejecución cuando se produjo el bloqueo: +{0} +Esta prueba puede ser el origen del bloqueo o no serlo. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - Ha transcurrido el tiempo de inactividad especificado en minutos ({0}). Se va a recopilar un volcado y a terminar el proceso del host de prueba. + El tiempo de inactividad de {0} {1} que se ha especificado ha transcurrido. Recopilando volcados de bloqueos del host de pruebas y sus procesos secundarios {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + Todas las pruebas han terminado de ejecutarse; no se generará el archivo Sequence. "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + Volcando {0} - {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + Volcando este árbol de procesos (desde abajo) minutes - minutes + minutos seconds - seconds + segundos diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.fr.xlf index 7f13e124fb..f7c78b21b3 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.fr.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - La série de tests active a été abandonnée, car le processus hôte s'est arrêté de manière inattendue durant l'exécution du ou des tests suivants : + La série de tests active a été abandonnée, car le processus hôte s'est arrêté de manière inattendue. Inspectez la pile des appels ci-dessus, le cas échéant, pour obtenir plus d'informations sur l'origine de l'exception. +Test en cours d'exécution au moment du plantage : +{0} +Ce test est éventuellement à l'origine du plantage. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - Le délai d'inactivité spécifié, {0} minutes/s, s'est écoulé. Collecte d'une image mémoire et arrêt du processus hôte de test. + Le délai d'inactivité spécifié ({0} {1}) s'est écoulé. Collecte d'images mémoire des plantages de l'hôte de test et de ses processus enfants {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + Tous les tests ont fini de s'exécuter. Le fichier de séquence ne sera pas généré "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + Création d'une image mémoire {0} - {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + Création d'une image mémoire de cette arborescence de processus (à partir du bas) minutes - minutes + minutes seconds - seconds + secondes diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.it.xlf index e16e7fb09c..fb5b25200b 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.it.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - L'esecuzione dei test attiva è stata interrotta perché il processo host è stato terminato in modo imprevisto durante l'esecuzione del test o dei test seguenti: + L'esecuzione dei test attiva è stata interrotta perché il processo host è stato terminato in modo imprevisto. Esaminare lo stack di chiamate in alto, se disponibile, per ottenere altre informazioni sull'origine dell'eccezione. +Test in esecuzione quando si è verificato l'arresto anomalo: +{0} +Il test potrebbe essere l'origine dell'arresto anomalo. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - Il tempo di inattività specificato {0} di minuto/i è scaduto. Verrà raccolto un dump e il processo host di test verrà terminato. + Il tempo di inattività specificato di {0} {1} è scaduto. Verranno raccolti i dump in sospeso da testhost e dai relativi processi figlio {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + L'esecuzione di tutti i test è stata completata. Il file di sequenza non verrà generato "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + Dump di {0} - {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + Dump di questo albero processi (dal basso) minutes - minutes + minuti seconds - seconds + secondi diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ja.xlf index c2d6bd1575..c6de3c5798 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ja.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - 以下のテストの実行中にホスト プロセスが予期せず終了したため、アクティブなテスト実行が中止されました: + ホスト プロセスが予期せずに終了したため、アクティブなテストの実行が中止されました。(使用可能な場合) 上記の呼び出し履歴を調べて、例外の発生元に関する詳細情報を取得してください。 +クラッシュの発生時に実行中だったテスト: +{0} +このテストは、必ずしもクラッシュの原因ではない場合もあります。 {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - 指定された無通信時間 ({0} 分) が経過しました。ダンプを収集し、テスト ホスト プロセスを中止しています。 + 指定された非アイドル時間 {0} {1} が経過しました。testhost およびその子プロセスからのハング ダンプを収集しています {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + すべてのテストの実行が完了しました。Sequence ファイルは生成されません "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + {0} - {1} をダンプしています as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + このプロセス ツリーをダンプしています (下から) minutes - minutes + seconds - seconds + diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ko.xlf index cbc85432d1..1bb33e1509 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ko.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - 다음 테스트를 실행하는 동안 호스트 프로세스가 예기치 않게 종료되어 활성 테스트 실행이 중단되었습니다. + 호스트 프로세스가 예기치 않게 종료되어 활성 테스트 실행이 중단되었습니다. 사용 가능한 경우 예외가 발생한 위치에 대한 자세한 정보를 보려면 위의 호출 스택을 검사하세요. +크래시가 발생했을 때 실행 중이었던 테스트: +{0} +이 테스트는 크래시의 원인이거나 원인이 아닐 수 있습니다. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - 지정된 비활성 시간 {0}분을 경과했습니다. 덤프를 수집하고 테스트 호스트 프로세스를 종료합니다. + 지정한 비활성 시간({0}{1})이 경과되었습니다. Testhost 및 해당 자식 프로세스에서 중단 덤프를 수집하는 중 {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + 모든 테스트 실행이 완료되었지만, 시퀀스 파일이 생성되지 않습니다. "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + 덤프 {0} - {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + 이 프로세스 트리 덤핑(아래쪽에서) minutes - minutes + seconds - seconds + diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pl.xlf index 6e0651cf89..c022296bcd 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pl.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - Aktywny przebieg testu został przerwany, ponieważ proces hosta nieoczekiwanie zakończył działanie podczas wykonywania następujących testów: + Aktywny przebieg testu został przerwany, ponieważ proces hosta nieoczekiwanie zakończył działanie. Sprawdź powyższy stos wywołań, jeśli jest dostępny, aby uzyskać więcej informacji na temat miejsca, z którego pochodzi wyjątek. +Test uruchomiony w momencie wystąpienia awarii: +{0} +Ten test może, ale nie musi być źródłem awarii. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - Wybrany czas nieaktywności wynoszący {0} min upłynął. Zbieranie zrzutu i zabijanie procesu hosta testu. + Upłynął czas nieaktywności {0} {1}. Zbieranie zrzutów podczas zawieszenia z procesu testhost i jego procesów podrzędnych {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + Wszystkie testy zakończyły działanie, plik sekwencji nie zostanie wygenerowany "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + Tworzenie zrzutu: {0} — {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + Tworzenie zrzutu tego drzewa procesów (od dołu) minutes - minutes + min seconds - seconds + s diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pt-BR.xlf index 6aa314fdc7..320f28929e 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pt-BR.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - A Execução de Teste ativa foi anulada pois o processo do host saiu inesperadamente ao executar os seguintes testes: + A Execução de Teste ativa foi anulada porque o processo do host foi encerrado inesperadamente. Inspecione a pilha de chamadas acima, caso ela esteja disponível, para obter mais informações sobre a origem da exceção. +O teste em execução quando a falha ocorreu: +{0} +Esse teste pode ser a origem da falha ou não. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - O tempo de inatividade especificado de {0} minutos terminou. Coletando um despejo e encerrando o processo de host do teste. + O tempo de inatividade especificado de {0} {1} foi decorrido. Coletando os despejos do travamento do testhost e dos processos filho {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + A execução de todos os testes foi concluída. O arquivo de sequência não será gerado. "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + Despejando {0} – {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + Despejando esta árvore de processos (da parte inferior) minutes - minutes + minutos seconds - seconds + segundos diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ru.xlf index 0a710dd9c9..1b68caba36 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ru.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - Активный тестовый запуск прерван, так как хост-процесс завершил работу непредвиденным образом при выполнении следующих тестов: + Активный тестовый запуск был прерван из-за непредвиденного завершения хост-процесса. Просмотрите стек вызовов выше (если он доступен), чтобы получить дополнительные сведения об источнике исключения. +Тест, который выполнялся в момент возникновения сбоя: +{0} +Этот тест может являться источником сбоя. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - Указанное время бездействия ({0} мин) прошло. Сбор дампа и завершение хост-процесса тестирования. + Указанное время неактивности {0} {1} истекло. Сбор дампов зависаний из тестового узла и его дочерних процессов. {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + Все тесты завершены, файл последовательности не будет создан. "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + Создание дампа {0} — {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + Создание дампа для этого дерева процессов (из нижней части) minutes - minutes + мин seconds - seconds + с diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.tr.xlf index 23c3668e97..00d28d5fe7 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.tr.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - Aşağıdaki testler yürütülürken konak işleminden beklenmedik bir şekilde çıkıldığından etkin Test Çalıştırması iptal edildi: + Konak işleminden beklenmedik şekilde çıkış yapıldığından etkin Test Çalıştırması durduruldu. Özel durumun kaynağı hakkında daha fazla bilgi almak için varsa yukarıdan çağrı yığınını inceleyin. +Kilitlenme oluştuğunda çalışan test: +{0} +Bu test, kilitlenmenin kaynağı olmayabilir veya olmayabilir. {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - Belirtilen {0} dakikalık etkin olmama süresi geçti. Döküm toplanıyor ve test ana bilgisayarı işlemi sonlandırılıyor. + Belirtilen {0} {1} etkinlik dışı kalma süresi geçti. Testhost ve alt işlemlerinden askı dökümleri toplanıyor {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + Tüm testlerin çalışması tamamlandı. Dizi dosyası oluşturulmayacak. "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + {0} - {1} dökümü oluşturuluyor as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + Bu işlem ağacının dökümü alınıyor (alttan) minutes - minutes + dakika seconds - seconds + saniye diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hans.xlf index 55fd327124..505d992298 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hans.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - 执行以下测试时主机进程意外退出,活动的测试运行已中止: + 活动的测试运行已中止,因为主机进程意外退出。请检查上面的调用堆栈(如果有),以获取有关异常来源的详细信息。 +发生崩溃时运行的测试: +{0} +此测试可能是(也可能不是)崩溃的来源。 {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - 指定的非活动时间({0} 分钟)已经过。收集转储并终止测试主机进程。 + 指定的非活动时间({0} {1})已过。正在从测试主机及其子进程中收集挂起的转储 {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + 所有测试都已运行完毕,将不生成序列文件 "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + 正在转储 {0} - {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + 正在转储此进程树(从底部) minutes - minutes + 分钟 seconds - seconds + diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hant.xlf index 9be9aec885..13aebdf8db 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hant.xlf @@ -25,7 +25,10 @@ The test running when the crash occurred: {0} This test may, or may not be the source of the crash. - 因為主機處理序在執行下列測試時未預期地結束,所以使用中的測試回合已中止: + 因為主機處理序在未預期的狀況下結束,所以已中止使用中的測試回合。請檢查上方的呼叫堆疊 (若有的話),以取得例外狀況來源的詳細資訊。 +發生損毀時正在執行的測試: +{0} +此測試可能是或不是損毀的來源。 {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. @@ -60,7 +63,7 @@ This test may, or may not be the source of the crash. The specified inactivity time of {0} {1} has elapsed. Collecting hang dumps from testhost and its child processes - 已經過指定的閒置時間 {0} 分鐘/秒。正在收集傾印以及終止測試主機處理序。 + 指定的非使用狀態時間已經過 {0} {1}。正在從 testhost 及其子處理序收集停止回應的傾印 {0} value, {1} one of the unit strings below, Minutes/Seconds @@ -70,27 +73,27 @@ This test may, or may not be the source of the crash. All tests finished running, Sequence file will not be generated - All tests finished running, Sequence file will not be generated. + 所有測試皆已執行完成,將不會產生 Sequence 檔案 "Sequence" is the name of the file. Dumping {0} - {1} - Dumping {0} - {1} + 正在傾印 {0} - {1} as in creating a process dump, {0} process id, {1} process name Dumping this process tree (from bottom) - Dumping this process tree (from bottom) + 正在傾印此處理序樹狀結構 (從底部) minutes - minutes + 分鐘 seconds - seconds + diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.cs.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.cs.xlf index 47705beeaa..d75ddb68d8 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.cs.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.cs.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + Nepovedlo se najít dostupný název souboru pro {0} pomocí formátu časového razítka {2} v {1}. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.de.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.de.xlf index a3ff187953..6a4f1e96f0 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.de.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.de.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + Unter "{1}" wurde kein verfügbarer Dateiname für "{0}" mit dem Zeitstempelformat "{2}" abgerufen. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.es.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.es.xlf index bd533f167c..2dbe2da404 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.es.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.es.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + No se encuentra ningún nombre de archivo disponible para {0} con el formato de marca de tiempo "{2}" en {1}. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.fr.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.fr.xlf index 76c95a72d4..b635efac79 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.fr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.fr.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + Impossible de trouver un nom de fichier disponible pour {0} avec le format d'horodatage '{2}' à l'emplacement {1}. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.it.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.it.xlf index 754df4bd28..329b1e37b3 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.it.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.it.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + Non è possibile ottenere o trovare un nome file disponibile per {0} che usa il formato timestamp '{2}' nella directory {1}. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ja.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ja.xlf index 28c923da3a..d12762d191 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ja.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ja.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + {1} でタイムスタンプ形式 '{2}' を使用して {0} の使用可能なファイル名を取得できません。 diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ko.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ko.xlf index ef3f078165..27fbe7e1ab 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ko.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ko.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + {1}에서 타임스탬프 형식 '{2}'을(를) 사용하는 {0}의 사용 가능한 파일 이름을 찾을 수 없습니다. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.pl.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.pl.xlf index bdbedc31ad..38f0bddf57 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.pl.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.pl.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + Nie można znaleźć dostępnej nazwy pliku dla elementu {0} przy użyciu formatu sygnatury czasowej „{2}” o {1}. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.pt-BR.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.pt-BR.xlf index dd2c12574f..057672884f 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.pt-BR.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + Não é possível localizar um nome de arquivo disponível para {0} usando o formato de carimbo de data/hora '{2}' em {1}. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ru.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ru.xlf index eafbe35699..b7ae385562 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ru.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.ru.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + Не удается найти доступное имя файла в {0} с использованием формата метки времени "{2}" в {1}. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.tr.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.tr.xlf index 21c1b93cd0..98113d5706 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.tr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.tr.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - "{1}" altında "{2}" biçimlendirmesi ve "{0}" ismi kullanılarak müsait bir dosya adı bulunamadı. + {1} konumundaki '{2}' zaman damgası biçimi kullanılarak {0} için kullanılabilir bir dosya adı alınamıyor. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.zh-Hans.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.zh-Hans.xlf index 4d87c2e95f..14662e4dfa 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.zh-Hans.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + 无法在 {1} 处为 {0} 找到使用时间戳格式“{2}”的可用文件名。 diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.zh-Hant.xlf b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.zh-Hant.xlf index 079adba278..fc8c6e6ba8 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Resources/xlf/TrxResource.zh-Hant.xlf @@ -305,7 +305,7 @@ Fehlerdetails: {1}: {2} Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. - Cannot get find an available filename for {0} using timestamp format '{2}' at {1}. + 無法在 {1} 中使用時間戳記格式 '{2}' 找到 {0} 的可用檔案名。 diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs index 0c669ecfc8..7023ba8f82 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs @@ -165,7 +165,7 @@ internal string GetRunLevelInformationalMessage() return this.runLevelStdOut.ToString(); } - internal List GetRunLevelErrorsAndWarnings() + internal List GetRunLevelErrorsAndWarnings() { return this.runLevelErrorsAndWarnings; } @@ -233,19 +233,19 @@ internal void TestMessageHandler(object sender, TestRunMessageEventArgs e) ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); - TrxLoggerObjectModel.RunInfo runMessage; + RunInfo runMessage; switch (e.Level) { case TestMessageLevel.Informational: this.AddRunLevelInformationalMessage(e.Message); break; case TestMessageLevel.Warning: - runMessage = new TrxLoggerObjectModel.RunInfo(e.Message, null, Environment.MachineName, TrxLoggerObjectModel.TestOutcome.Warning); + runMessage = new RunInfo(e.Message, null, Environment.MachineName, TrxLoggerObjectModel.TestOutcome.Warning); this.runLevelErrorsAndWarnings.Add(runMessage); break; case TestMessageLevel.Error: this.testRunOutcome = TrxLoggerObjectModel.TestOutcome.Failed; - runMessage = new TrxLoggerObjectModel.RunInfo(e.Message, null, Environment.MachineName, TrxLoggerObjectModel.TestOutcome.Error); + runMessage = new RunInfo(e.Message, null, Environment.MachineName, TrxLoggerObjectModel.TestOutcome.Error); this.runLevelErrorsAndWarnings.Add(runMessage); break; default: @@ -355,7 +355,7 @@ internal void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) List categories = new List(); categories.Add(TestListCategory.UncategorizedResults); categories.Add(TestListCategory.AllResults); - helper.SaveList(categories, rootElement, "TestLists", ".", "TestList", parameters); + helper.SaveList(categories, rootElement, "TestLists", ".", "TestList", parameters); // Save summary if (this.testRunOutcome == TrxLoggerObjectModel.TestOutcome.Passed) @@ -365,7 +365,7 @@ internal void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) List errorMessages = new List(); List collectorEntries = this.converter.ToCollectionEntries(e.AttachmentSets, this.testRun, this.testResultsDirPath); - IList resultFiles = this.converter.ToResultFiles(e.AttachmentSets, this.testRun, this.testResultsDirPath, errorMessages); + IList resultFiles = this.converter.ToResultFiles(e.AttachmentSets, this.testRun, this.testResultsDirPath, errorMessages); if (errorMessages.Count > 0) { @@ -418,11 +418,11 @@ internal virtual void PopulateTrxFile(string trxFileName, XmlElement rootElement } } - String resultsFileMessage = String.Format(CultureInfo.CurrentCulture, TrxLoggerResources.TrxLoggerResultsFile, trxFileName); + string resultsFileMessage = string.Format(CultureInfo.CurrentCulture, TrxLoggerResources.TrxLoggerResultsFile, trxFileName); ConsoleOutput.Instance.Information(false, resultsFileMessage); EqtTrace.Info(resultsFileMessage); } - catch (System.UnauthorizedAccessException fileWriteException) + catch (UnauthorizedAccessException fileWriteException) { ConsoleOutput.Instance.Error(false, fileWriteException.Message); } @@ -431,8 +431,8 @@ internal virtual void PopulateTrxFile(string trxFileName, XmlElement rootElement // Initializes trx logger cache. private void InitializeInternal() { - this.results = new ConcurrentDictionary(); - this.innerResults = new ConcurrentDictionary(); + this.results = new ConcurrentDictionary(); + this.innerResults = new ConcurrentDictionary(); this.testElements = new ConcurrentDictionary(); this.entries = new ConcurrentDictionary(); this.innerTestEntries = new ConcurrentDictionary(); @@ -462,9 +462,9 @@ private void HandleSkippedTest(ObjectModel.TestResult rsTestResult) { Debug.Assert(rsTestResult.Outcome == ObjectModel.TestOutcome.Skipped, "Test Result should be skipped but it is " + rsTestResult.Outcome); - ObjectModel.TestCase testCase = rsTestResult.TestCase; + TestCase testCase = rsTestResult.TestCase; string testCaseName = !string.IsNullOrEmpty(testCase.DisplayName) ? testCase.DisplayName : testCase.FullyQualifiedName; - string message = String.Format(CultureInfo.CurrentCulture, TrxLoggerResources.MessageForSkippedTests, testCaseName); + string message = string.Format(CultureInfo.CurrentCulture, TrxLoggerResources.MessageForSkippedTests, testCaseName); this.AddRunLevelInformationalMessage(message); } @@ -505,6 +505,7 @@ private string AcquireTrxFileNamePath(out bool shouldOverwrite) var isLogFilePrefixParameterExists = parametersDictionary.TryGetValue(TrxLoggerConstants.LogFilePrefixKey, out string logFilePrefixValue) && !string.IsNullOrWhiteSpace(logFilePrefixValue); string filePath = null; + if (isLogFilePrefixParameterExists) { if (parametersDictionary.TryGetValue(DefaultLoggerParameterNames.TargetFramework, out var framework) && framework != null) @@ -525,7 +526,8 @@ private string AcquireTrxFileNamePath(out bool shouldOverwrite) filePath = filePath ?? this.SetDefaultTrxFilePath(); var trxFileDirPath = Path.GetDirectoryName(filePath); - if (Directory.Exists(trxFileDirPath) == false) + + if (!Directory.Exists(trxFileDirPath)) { Directory.CreateDirectory(trxFileDirPath); } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Collection.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Collection.cs index 28a398a156..207be6c6f7 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Collection.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Collection.cs @@ -9,6 +9,8 @@ namespace Microsoft.TestPlatform.Extensions.TrxLogger.Utility using Microsoft.TestPlatform.Extensions.TrxLogger.XML; using Microsoft.TestPlatform.Extensions.TrxLogger.ObjectModel; + using System.Xml; + /// /// Base class for Eqt Collections. /// Fast collection, default implementations (Add/Remove/etc) do not allow null items and ignore duplicates. @@ -52,6 +54,7 @@ public void Reset() public void Dispose() { + } } #endregion @@ -118,12 +121,12 @@ public virtual bool Contains(T item) public virtual bool Remove(T item) { EqtAssert.ParameterNotNull(item, "item"); // This is to be consistent with Add... - if (this.container.Contains(item)) { this.container.Remove(item); return true; } + return false; } @@ -179,11 +182,12 @@ IEnumerator IEnumerable.GetEnumerator() /// Default behavior is to create child elements with name same as name of type T. /// Does not respect IXmlTestStoreCustom. /// - public virtual void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) + public virtual void Save(XmlElement element, XmlTestStoreParameters parameters) { - XmlPersistence h = new XmlPersistence(); - h.SaveHashtable(this.container, element, ".", ".", null, ChildElementName, parameters); + XmlPersistence xmlPersistence = new XmlPersistence(); + xmlPersistence.SaveHashtable(this.container, element, ".", ".", null, ChildElementName, parameters); } + #endregion #region Private diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs index d9f479ff68..cbcf4c962c 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs @@ -49,9 +49,9 @@ public ITestElement ToTestElement( Guid testId, Guid executionId, Guid parentExecutionId, - String testName, + string testName, TestType testType, - ObjectModel.TestCase rockSteadyTestCase) + TestCase rockSteadyTestCase) { var testElement = CreateTestElement(testId, testName, rockSteadyTestCase.FullyQualifiedName, rockSteadyTestCase.ExecutorUri.ToString(), rockSteadyTestCase.Source, testType); @@ -99,7 +99,7 @@ public ITestResult ToTestResult( ObjectModel.TestResult rockSteadyTestResult) { var resultName = !string.IsNullOrEmpty(rockSteadyTestResult.DisplayName) ? rockSteadyTestResult.DisplayName : testName; - var testResult = CreateTestResult(testRun.Id, testId, executionId, parentExecutionId, resultName, Environment.MachineName, testOutcome, testType, testCategoryId); + var testResult = CreateTestResult(testRun.Id, testId, executionId, parentExecutionId, resultName, testOutcome, testType, testCategoryId); if (rockSteadyTestResult.ErrorMessage != null) testResult.ErrorMessage = rockSteadyTestResult.ErrorMessage; @@ -163,7 +163,6 @@ public TrxObjectModel.TestOutcome ToOutcome(ObjectModel.TestOutcome rockSteadyOu public List ToCollectionEntries(IEnumerable attachmentSets, TestRun testRun, string trxFileDirectory) { - List collectorEntries = new List(); if (attachmentSets == null) { @@ -204,7 +203,7 @@ public IList ToResultFiles(IEnumerable attach { try { - IList testResultFiles = ToResultFiles(attachmentSet, Guid.Empty, testRun, trxFileDirectory); + IList testResultFiles = ToResultFiles(attachmentSet, Guid.Empty, testRun, trxFileDirectory); resultFiles.AddRange(testResultFiles); } catch (Exception e) @@ -216,9 +215,9 @@ public IList ToResultFiles(IEnumerable attach e.GetType().ToString(), e); - if (ObjectModel.EqtTrace.IsErrorEnabled) + if (EqtTrace.IsErrorEnabled) { - ObjectModel.EqtTrace.Error("Converter: ToResultFiles: " + errorMsg); + EqtTrace.Error("Converter: ToResultFiles: " + errorMsg); } errorMessages.Add(errorMsg); @@ -239,27 +238,27 @@ private void UpdateResultMessages(TrxObjectModel.TestResult unitTestResult, Obje StringBuilder stdErr = new StringBuilder(); StringBuilder stdOut = new StringBuilder(); - foreach (Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResultMessage message in testResult.Messages) + foreach (TestResultMessage message in testResult.Messages) { - if (ObjectModel.TestResultMessage.AdditionalInfoCategory.Equals(message.Category, StringComparison.OrdinalIgnoreCase)) + if (TestResultMessage.AdditionalInfoCategory.Equals(message.Category, StringComparison.OrdinalIgnoreCase)) { unitTestResult.AddTextMessage(message.Text); } - else if (ObjectModel.TestResultMessage.DebugTraceCategory.Equals(message.Category, StringComparison.OrdinalIgnoreCase)) + else if (TestResultMessage.DebugTraceCategory.Equals(message.Category, StringComparison.OrdinalIgnoreCase)) { debugTrace.AppendLine(message.Text); } - else if (ObjectModel.TestResultMessage.StandardErrorCategory.Equals(message.Category, StringComparison.OrdinalIgnoreCase)) + else if (TestResultMessage.StandardErrorCategory.Equals(message.Category, StringComparison.OrdinalIgnoreCase)) { stdErr.AppendLine(message.Text); } - else if (ObjectModel.TestResultMessage.StandardOutCategory.Equals(message.Category, StringComparison.OrdinalIgnoreCase)) + else if (TestResultMessage.StandardOutCategory.Equals(message.Category, StringComparison.OrdinalIgnoreCase)) { stdOut.AppendLine(message.Text); } else { - ObjectModel.EqtTrace.Warning("The message category " + message.Category + " does not match any predefined category."); + EqtTrace.Warning("The message category " + message.Category + " does not match any predefined category."); } } @@ -274,7 +273,7 @@ private void UpdateResultMessages(TrxObjectModel.TestResult unitTestResult, Obje /// TestCase object extracted from the TestResult /// Property Name from the list of properties in TestCase /// list of properties - public List GetCustomPropertyValueFromTestCase(ObjectModel.TestCase testCase, string categoryID) + public List GetCustomPropertyValueFromTestCase(TestCase testCase, string categoryID) { var customProperty = testCase.Properties.FirstOrDefault(t => t.Id.Equals(categoryID)); @@ -287,11 +286,11 @@ public List GetCustomPropertyValueFromTestCase(ObjectModel.TestCase test } else { - return Enumerable.Empty().ToList(); + return Enumerable.Empty().ToList(); } } - return Enumerable.Empty().ToList(); + return Enumerable.Empty().ToList(); } /// @@ -300,13 +299,13 @@ public List GetCustomPropertyValueFromTestCase(ObjectModel.TestCase test /// /// /// Test id - public Guid GetTestId(ObjectModel.TestCase rockSteadyTestCase) + public Guid GetTestId(TestCase rockSteadyTestCase) { Guid testId = Guid.Empty; // Setting test id to tmi test id. - ObjectModel.TestProperty tmiTestIdProperty = rockSteadyTestCase.Properties.FirstOrDefault( - property => property.Id.Equals(Constants.TmiTestIdPropertyIdentifier)); + TestProperty tmiTestIdProperty = rockSteadyTestCase.Properties.FirstOrDefault( + property => property.Id.Equals(Constants.TmiTestIdPropertyIdentifier)); if (null != tmiTestIdProperty) testId = rockSteadyTestCase.GetPropertyValue(tmiTestIdProperty, Guid.Empty); @@ -326,7 +325,7 @@ public Guid GetTestId(ObjectModel.TestCase rockSteadyTestCase) public Guid GetParentExecutionId(ObjectModel.TestResult testResult) { TestProperty parentExecutionIdProperty = testResult.Properties.FirstOrDefault( - property => property.Id.Equals(Constants.ParentExecutionIdPropertyIdentifier)); + property => property.Id.Equals(Constants.ParentExecutionIdPropertyIdentifier)); return parentExecutionIdProperty == null ? Guid.Empty : @@ -394,7 +393,7 @@ private void UpdateTestResultAttachments(ObjectModel.TestResult rockSteadyTestRe // data collection files List collectorEntries = new List(); - foreach (ObjectModel.AttachmentSet attachmentSet in rockSteadyTestResult.Attachments) + foreach (AttachmentSet attachmentSet in rockSteadyTestResult.Attachments) { try { @@ -419,9 +418,9 @@ private void UpdateTestResultAttachments(ObjectModel.TestResult rockSteadyTestRe e.GetType().ToString(), e); - if (ObjectModel.EqtTrace.IsErrorEnabled) + if (EqtTrace.IsErrorEnabled) { - ObjectModel.EqtTrace.Error("Converter: UpdateTestResultAttachments: " + errorMsg); + EqtTrace.Error("Converter: UpdateTestResultAttachments: " + errorMsg); } StringBuilder stdErr = new StringBuilder(testResult.StdErr); @@ -447,7 +446,7 @@ private void UpdateTestResultAttachments(ObjectModel.TestResult rockSteadyTestRe } // Returns a list of collector entry - private CollectorDataEntry ToCollectorEntry(ObjectModel.AttachmentSet attachmentSet, Guid testResultExecutionId, TestRun testRun, string trxFileDirectory) + private CollectorDataEntry ToCollectorEntry(AttachmentSet attachmentSet, Guid testResultExecutionId, TestRun testRun, string trxFileDirectory) { string runDirectoryName = Path.Combine(trxFileDirectory, testRun.RunConfiguration.RunDeploymentRootDirectory); string inDirectory = Path.Combine(runDirectoryName, "In"); @@ -468,12 +467,14 @@ private CollectorDataEntry ToCollectorEntry(ObjectModel.AttachmentSet attachment List uriDataAttachments = new List(); foreach (ObjectModel.UriDataAttachment uriDataAttachment in attachmentSet.Attachments) { - if (ObjectModel.EqtTrace.IsVerboseEnabled) + if (EqtTrace.IsVerboseEnabled) { - ObjectModel.EqtTrace.Verbose("TrxLogger: ToCollectorEntry: Got attachment " + uriDataAttachment.Uri + " with description " + uriDataAttachment.Description); + EqtTrace.Verbose("TrxLogger: ToCollectorEntry: Got attachment " + uriDataAttachment.Uri + " with description " + uriDataAttachment.Description); } string sourceFile = uriDataAttachment.Uri.LocalPath; + + var rooted = (Path.GetFullPath(sourceFile) == sourceFile); Debug.Assert(Path.IsPathRooted(sourceFile), "Source file is not rooted"); // copy the source file to the target location @@ -493,9 +494,9 @@ private CollectorDataEntry ToCollectorEntry(ObjectModel.AttachmentSet attachment } catch(Exception ex) { - if (ObjectModel.EqtTrace.IsErrorEnabled) + if (EqtTrace.IsErrorEnabled) { - ObjectModel.EqtTrace.Error("Trxlogger: ToCollectorEntry: " + ex); + EqtTrace.Error("Trxlogger: ToCollectorEntry: " + ex); } } } @@ -510,7 +511,7 @@ private CollectorDataEntry ToCollectorEntry(ObjectModel.AttachmentSet attachment } // Get the path to the result files - private IList ToResultFiles(ObjectModel.AttachmentSet attachmentSet, Guid testResultExecutionId, TestRun testRun, string trxFileDirectory) + private IList ToResultFiles(AttachmentSet attachmentSet, Guid testResultExecutionId, TestRun testRun, string trxFileDirectory) { string runDirectoryName = Path.Combine(trxFileDirectory, testRun.RunConfiguration.RunDeploymentRootDirectory); string testResultDirectory = Path.Combine(runDirectoryName, "In"); @@ -532,9 +533,9 @@ private IList ToResultFiles(ObjectModel.AttachmentSet attachmentSet, Gui { string sourceFile = uriDataAttachment.Uri.IsAbsoluteUri ? uriDataAttachment.Uri.LocalPath : uriDataAttachment.Uri.ToString(); - if (ObjectModel.EqtTrace.IsVerboseEnabled) + if (EqtTrace.IsVerboseEnabled) { - ObjectModel.EqtTrace.Verbose("TrxLogger: ToResultFiles: Got attachment " + uriDataAttachment.Uri + " with local path " + sourceFile); + EqtTrace.Verbose("TrxLogger: ToResultFiles: Got attachment " + uriDataAttachment.Uri + " with local path " + sourceFile); } Debug.Assert(Path.IsPathRooted(sourceFile), "Source file is not rooted"); @@ -552,9 +553,9 @@ private IList ToResultFiles(ObjectModel.AttachmentSet attachmentSet, Gui } catch(Exception ex) { - if (ObjectModel.EqtTrace.IsErrorEnabled) + if (EqtTrace.IsErrorEnabled) { - ObjectModel.EqtTrace.Error("Trxlogger: ToResultFiles: " + ex); + EqtTrace.Error("Trxlogger: ToResultFiles: " + ex); } } } @@ -570,9 +571,9 @@ private void CopyFile(string sourceFile, string targetFile) } catch (Exception ex) { - if (ObjectModel.EqtTrace.IsErrorEnabled) + if (EqtTrace.IsErrorEnabled) { - ObjectModel.EqtTrace.Error("Trxlogger: Failed to copy file {0} to {1}. Reason:{2}", sourceFile, targetFile, ex); + EqtTrace.Error("Trxlogger: Failed to copy file {0} to {1}. Reason:{2}", sourceFile, targetFile, ex); } throw; @@ -584,12 +585,12 @@ private void CopyFile(string sourceFile, string targetFile) /// /// /// Priority - private int GetPriority(ObjectModel.TestCase rockSteadyTestCase) + private int GetPriority(TestCase rockSteadyTestCase) { int priority = int.MaxValue; - ObjectModel.Trait priorityTrait = rockSteadyTestCase.Traits?.FirstOrDefault(t => t.Name.Equals("Priority")); - if (priorityTrait != null && Int32.TryParse(priorityTrait.Value, out int priorityValue)) + Trait priorityTrait = rockSteadyTestCase.Traits?.FirstOrDefault(t => t.Name.Equals("Priority")); + if (priorityTrait != null && int.TryParse(priorityTrait.Value, out int priorityValue)) priority = priorityValue; return priority; @@ -600,11 +601,11 @@ private int GetPriority(ObjectModel.TestCase rockSteadyTestCase) /// /// /// Owner - private string GetOwner(ObjectModel.TestCase rockSteadyTestCase) + private string GetOwner(TestCase rockSteadyTestCase) { string owner = null; - ObjectModel.Trait ownerTrait = rockSteadyTestCase.Traits?.FirstOrDefault(t => t.Name.Equals("Owner")); + Trait ownerTrait = rockSteadyTestCase.Traits?.FirstOrDefault(t => t.Name.Equals("Owner")); if (ownerTrait != null) owner = ownerTrait.Value; @@ -647,7 +648,7 @@ private string GetTestClassName(string testName, string fullyQualifiedName, stri try { string testCaseSource = Path.GetFileNameWithoutExtension(source); - if (!String.IsNullOrEmpty(testCaseSource)) + if (!string.IsNullOrEmpty(testCaseSource)) { return testCaseSource; } @@ -655,9 +656,9 @@ private string GetTestClassName(string testName, string fullyQualifiedName, stri catch (ArgumentException ex) { // If source is not valid file path, then className will continue to point default value. - if (ObjectModel.EqtTrace.IsVerboseEnabled) + if (EqtTrace.IsVerboseEnabled) { - ObjectModel.EqtTrace.Verbose("Converter: GetTestClassName: " + ex); + EqtTrace.Verbose("Converter: GetTestClassName: " + ex); } } @@ -706,7 +707,6 @@ private TestElement CreateTestElement(Guid testId, string name, string fullyQual /// /// /// - /// /// /// /// @@ -717,7 +717,6 @@ private TrxObjectModel.TestResult CreateTestResult( Guid executionId, Guid parentExecutionId, string resultName, - string computerName, TrxObjectModel.TestOutcome outcome, TestType testType, TestListCategoryId testCategoryId) diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/TrxFileHelper.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/TrxFileHelper.cs index 6461def174..3748406548 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/TrxFileHelper.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/TrxFileHelper.cs @@ -21,8 +21,7 @@ internal class TrxFileHelper { private const string RelativeDirectorySeparator = ".."; - private static readonly Dictionary InvalidFileNameChars; - private static readonly Dictionary AdditionalInvalidFileNameChars; + private static readonly HashSet InvalidFileNameChars; private static readonly Regex ReservedFileNamesRegex = new Regex(@"(?i:^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9]|CLOCK\$)(\..*)?)$"); private readonly Func TimeProvider; @@ -36,7 +35,7 @@ static TrxFileHelper() // See https://github.com/dotnet/coreclr/blob/8e99cd8031b2f568ea69116e7cf96d55e32cb7f5/src/mscorlib/shared/System/IO/Path.Windows.cs#L12-L19 // These are manually listed here to avoid characters that may be valid on Linux but would make a filename invalid when copying the file to Windows. // Path.GetInvalidFileNameChars on Linux only contains { \0, / } - var invalidCharsArray = new char[] + InvalidFileNameChars = new HashSet { '\"', '<', '>', '|', '\0', (char)1, (char)2, (char)3, (char)4, (char)5, (char)6, (char)7, (char)8, (char)9, (char)10, @@ -45,23 +44,16 @@ static TrxFileHelper() (char)31, ':', '*', '?', '\\', '/' }; - InvalidFileNameChars = new Dictionary(invalidCharsArray.Length); - foreach (char c in invalidCharsArray) - { - InvalidFileNameChars.Add(c, null); - } - // Needed because when kicking off qtsetup.bat cmd.exe is used. '@' is a special character // for cmd so must be removed from the path to the bat file - AdditionalInvalidFileNameChars = new Dictionary(5); - AdditionalInvalidFileNameChars.Add('@', null); - AdditionalInvalidFileNameChars.Add('(', null); - AdditionalInvalidFileNameChars.Add(')', null); - AdditionalInvalidFileNameChars.Add('^', null); + InvalidFileNameChars.Add('@'); + InvalidFileNameChars.Add('('); + InvalidFileNameChars.Add(')'); + InvalidFileNameChars.Add('^'); // Replace white space with underscore from folder/file name to make it command line friendly // Related issues https://github.com/Microsoft/vstest/issues/244 & https://devdiv.visualstudio.com/DevDiv/_workitems?id=507982&_a=edit - AdditionalInvalidFileNameChars.Add(' ', null); + InvalidFileNameChars.Add(' '); } public TrxFileHelper() : this(() => DateTime.Now) { } @@ -90,8 +82,7 @@ public string ReplaceInvalidFileNameChars(string fileName) // Replace each invalid char with replacement char. for (int i = 0; i < fileName.Length; ++i) { - if (InvalidFileNameChars.ContainsKey(fileName[i]) || - AdditionalInvalidFileNameChars.ContainsKey(fileName[i])) + if (InvalidFileNameChars.Contains(fileName[i])) { result[i] = replacementChar; } @@ -167,6 +158,7 @@ public string GetNextTimestampFileName(string directoryName, string fileName, st var tryMe = fileNamePrefix + iterationStamp.ToString(timestampFormat, DateTimeFormatInfo.InvariantInfo) + extension; string tryMePath = Path.Combine(directoryName, tryMe); + if (!File.Exists(tryMePath)) { return tryMePath; @@ -404,6 +396,7 @@ internal override string NextIteration(string baseName, uint iteration) internal override bool IsValidIteration(string path) { Debug.Assert(!string.IsNullOrEmpty(path), "path is null"); + if (File.Exists(path) || Directory.Exists(path)) { return false; diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs index 44b3a53cb0..eee3e0fea3 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs @@ -19,8 +19,8 @@ namespace Microsoft.TestPlatform.Extensions.TrxLogger.XML using Microsoft.VisualStudio.TestPlatform.ObjectModel; - using TrxObjectModel = Microsoft.TestPlatform.Extensions.TrxLogger.ObjectModel; - using TrxLoggerResources = Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger.Resources.TrxResource; + using TrxObjectModel = ObjectModel; + using System.Text; /// /// The xml persistence class. @@ -92,11 +92,6 @@ public object Key private static readonly Type BoolType = typeof(bool); private static readonly Type ByteArrayType = typeof(byte[]); private static readonly Type DateTimeType = typeof(DateTime); - private static readonly Type TimeSpanType = typeof(TimeSpan); - private static readonly Type UriType = typeof(Uri); - private static readonly Type GuidType = typeof(Guid); - private static readonly Type TestElementType = typeof(TrxObjectModel.UnitTestElement); - private static readonly Type TestResultType = typeof(TrxObjectModel.UnitTestResult); /// /// this is the top level cache: Type->field information @@ -104,12 +99,6 @@ public object Key private static Dictionary> typeToPersistenceInfoCache = new Dictionary>(); - /// - /// cache for type->persistence string mapping - /// - private static Dictionary typeToPersistenceString = new Dictionary(); - - /// /// Optimization: avoid re-parsing same query multiple times /// @@ -676,7 +665,7 @@ private void SaveSimpleData(object value, XmlNode nodeToSaveAt, object defaultVa } // Remove invalid char if any - valueToSave = XmlPersistence.RemoveInvalidXmlChar(valueToSave); + valueToSave = RemoveInvalidXmlChar(valueToSave); XmlElement elementToSaveAt = nodeToSaveAt as XmlElement; if (elementToSaveAt != null) { @@ -713,7 +702,7 @@ private static string RemoveInvalidXmlChar(string str) private static string ReplaceInvalidCharacterWithUniCodeEscapeSequence(Match match) { char x = match.Value[0]; - return String.Format(@"\u{0:x4}", (ushort)x); + return string.Format(@"\u{0:x4}", (ushort)x); } @@ -858,26 +847,27 @@ private string ProcessXPathQuery(string queryIn) // fix the empty namespaces to a temp prefix, so xpath query can understand them string[] parts = queryIn.Split(new char[] { '/' }, StringSplitOptions.None); - string query = string.Empty; + StringBuilder query = new StringBuilder(); foreach (string part in parts) { if (query.Length > 0 || queryIn.StartsWith("/", StringComparison.Ordinal)) { - query += '/'; + query.Append('/'); } if (part != "." && part != ".." && !part.Contains(":") && (part.Length > 0) && (!part.StartsWith("@", StringComparison.Ordinal))) { - query += DefaultNamespacePrefixEquivalent + ":"; + query.Append(DefaultNamespacePrefixEquivalent + ":"); } - query += part; + query.Append(part); } - queryCache[queryIn] = query; + string queryString = query.ToString(); + queryCache[queryIn] = queryString; - return query; + return queryString; } #endregion Utilities diff --git a/src/Microsoft.TestPlatform.ObjectModel/Logger/LoggerSettings.cs b/src/Microsoft.TestPlatform.ObjectModel/Logger/LoggerSettings.cs index 02cd06ed0f..a2e1fae963 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Logger/LoggerSettings.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Logger/LoggerSettings.cs @@ -151,7 +151,7 @@ internal static LoggerSettings FromXml(XmlReader reader) #endif { throw new SettingsException( - String.Format( + string.Format( CultureInfo.CurrentCulture, Resources.Resources.InvalidUriInSettings, reader.Value, diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.cs.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.cs.xlf index 8086b433f7..569794e192 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.cs.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.cs.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - Testovací běh použije knihovny DLL sestavené pro rozhraní {0} a platformu {1}. Tyto knihovny DLL nebudou součástí běhu: {2}Další podrobnosti o správě těchto nastavení najdete na adrese {3}. - + Otestujte zjištěné knihovny DLL, které se vytvořily pro různé verze architektury a platformy. Následující knihovny DLL neodpovídají aktuálnímu nastavení, tedy architektuře {0} a platformě {1}.{2}Další podrobnosti o správě těchto nastavení najdete v {3}. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.de.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.de.xlf index 4ae86e5507..c1506af65a 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.de.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.de.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - Der Testlauf verwendet DLLs, die für das Framework {0} und die Plattform {1} erstellt wurden. Die folgenden DLLs sind nicht Teil der Ausführung: {2}.Navigieren Sie zu {3}, um weitere Details zum Verwalten dieser Einstellungen zu erhalten. - + Beim Testlauf wurden DLLs erkannt, die für verschiedene Framework- und Plattformversionen erstellt wurden. Die folgenden DLLs entsprechen nicht den aktuellen Einstellungen: Framework {0} und Plattform {1}.{2}Wechseln Sie zu {3}, um weitere Informationen zum Verwalten dieser Einstellungen zu erhalten. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.es.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.es.xlf index 1b6ac492fa..a3f5ff9f6b 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.es.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.es.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - La serie de pruebas usará archivos DLL compilados para el marco {0} y la plataforma {1}. Los siguientes archivos DLL no formarán parte de la ejecución: {2}Vaya a {3} para obtener más información sobre cómo administrar esta configuración. - + La serie de pruebas detectó archivos DLL que se compilaron para diferentes versiones de marco de trabajo y plataforma. Los siguientes archivos DLL no coinciden con la configuración actual, que es el marco de trabajo {0} y la plataforma {1}. {2}Vaya a {3} para obtener más información sobre cómo administrar esta configuración. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.fr.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.fr.xlf index 5c919ba88d..7dfe760725 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.fr.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.fr.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - La série de tests utilise des DLL générées pour le framework {0} et la plateforme {1}. Les DLL suivantes ne font pas partie de la série de tests : {2}Accédez à {3} pour plus de détails sur la gestion de ces paramètres. - + La série de tests a détecté une ou plusieurs DLL qui ont été générées pour d'autres versions de framework et de plateforme. La ou les DLL suivantes ne correspondent pas aux paramètres actuels : framework {0} et plateforme {1}.{2}Accédez à {3} pour plus d'informations sur la gestion de ces paramètres. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.it.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.it.xlf index 13466ee155..b2a0304758 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.it.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.it.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - Per l'esecuzione dei test verranno usate DLL compilate per il framework {0} e la piattaforma {1}. Le DLL seguenti non saranno incluse nell'esecuzione: {2}.Per maggiori dettagli sulla gestione di queste impostazioni, passare a {3}. - + L'esecuzione dei test ha rilevato DLL compilate per versioni diverse del framework e della piattaforma. Le DLL seguenti non corrispondono alle impostazioni correnti, ovvero al framework {0} e alla piattaforma {1}.{2}Per altri dettagli sulla gestione di queste impostazioni, vedere {3}. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ja.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ja.xlf index a8fbaf1ac7..569e392072 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ja.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ja.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - テスト実行ではフレームワーク {0} およびプラットフォーム {1} 用にビルドされた DLL を使用します。次の DLL は実行には含まれません: {2}これらの設定の管理方法の詳細については、{3} にアクセスしてください。 - + テストの実行で、別のフレームワークとプラットフォームのバージョン用にビルドされた DLL が検出されました。以下の DLL は、現在の設定と一致しません。現在のフレームワーク: {0}、プラットフォーム: {1}。{2}これらの設定を管理することについて詳しくは、{3} にアクセスしてください。 Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ko.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ko.xlf index c71f96ab0c..dd2c686704 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ko.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ko.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - 테스트 실행에서는 프레임워크 {0} 및 플랫폼 {1}용으로 작성된 DLL을 사용합니다. 다음 DLL은 실행에서 사용할 수 없습니다. {2}.이러한 설정의 관리에 대한 자세한 내용은 {3}을(를) 참조하세요. - + 테스트 실행에서 다른 프레임워크 및 플랫폼 버전용으로 빌드된 DLL을 감지했습니다. 다음 DLL은 현재 설정({0} 프레임워크 및 {1} 플랫폼)과 일치하지 않습니다.{2}이 설정을 관리하는 방법에 대한 자세한 내용을 보려면 {3}(으)로 이동하세요. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.pl.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.pl.xlf index d02d4e7232..d91ed7ac09 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.pl.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.pl.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - Przebieg testu użyje plików DLL przeznaczonych dla struktury {0} i platformy {1}. Następujące pliki DLL nie pasują do ustawień struktury/platformy.{2}.Aby uzyskać więcej informacji na temat zarządzania tymi ustawieniami, przejdź do strony {3}. - + Przebieg testowy wykrył biblioteki DLL utworzone dla innych wersji struktury i platformy. Następujące biblioteki DLL są niezgodne z bieżącymi ustawieniami (określającymi strukturę {0} i platformę {1}).{2}Aby uzyskać więcej informacji o zarządzaniu tymi ustawieniami, przejdź do: {3}. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.pt-BR.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.pt-BR.xlf index 8078a37670..dbfc0cd023 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.pt-BR.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - A execução de teste usará DLLs criadas para a estrutura {0} e a plataforma {1}. As seguintes DLLs não farão parte da execução: {2}Acesse {3} para obter mais detalhes sobre como gerenciar essas configurações. - + A execução de teste detectou DLLs que foram criadas para diferentes versões de estrutura e de plataforma. As DLLs a seguir não correspondem às configurações atuais, que são a estrutura {0} e a plataforma {1}. {2}Acesse {3} para obter mais detalhes sobre o gerenciamento dessas configurações. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ru.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ru.xlf index c71f7deec3..2d1c3e14a0 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ru.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.ru.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - При запуске тестов будут использоваться библиотеки DLL, собранные для платформ {0} и {1}. Следующие библиотеки DLL не будут участвовать в запуске: {2}.Дополнительные сведения об управлении этими параметрами см. в разделе {3}. - + Тестовый запуск обнаружил библиотеки DLL, которые были созданы для различных версий инфраструктуры и платформы. Следующие библиотеки DLL не соответствуют текущим параметрам (инфраструктура {0} и платформа {1}).{2}Перейдите по ссылке {3} для получения дополнительных сведений об управлении этими параметрами. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.tr.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.tr.xlf index 3a28809598..70fda61dc3 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.tr.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.tr.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - Test çalıştırmasında, {0} çerçevesi ve {1} platformu için oluşturulan DLL’ler kullanılacak. Şu DLL’ler çalıştırmaya dahil edilmeyecek: {2}Bu ayarları yönetmeye ilişkin ayrıntılar için {3} sayfasına gidin. - + Test çalıştırması, farklı çerçeve ve platform sürümleri için oluşturulmuş DLL'ler buldu. Aşağıdaki DLL'ler, {0} çerçevesi ve {1} platformu olan geçerli ayarlarla eşleşmiyor. {2}Bu ayarları yönetme hakkında daha fazla ayrıntı için {3} bölümüne gidin. Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.zh-Hans.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.zh-Hans.xlf index 07443c2faf..88e203bf76 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.zh-Hans.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - 测试运行将使用为框架 {0} 和平台 {1} 生成的 DLL。以下 DLL 将不是运行的一部分: {2}转到 {3} 了解有关管理这些设置的详细信息。 - + 测试运行检测到为不同框架和平台版本构建的 DLL。后面的 DLL 与当前设置(即 {0} 框架和 {1} 平台)不匹配。{2}如需了解如何管理这些设置,请转到 {3}。 Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.zh-Hant.xlf b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.zh-Hant.xlf index 155f7775e9..e9179ed1aa 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/CommonResources.zh-Hant.xlf @@ -31,8 +31,7 @@ Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are {0} framework and {1} platform.{2}Go to {3} for more details on managing these settings. - 測試回合將使用替架構 {0} 與平台 {1} 所建置的 DLL。下列 DLL 將不包含在測試回合中: {2}如需如何管理這些設定的詳細資料,請前往 {3}。 - + 測試回合偵測到為不同架構和平台版本所建置的 DLL。下列 DLL 與目前的設定不相符,亦即 {0} 架構及 {1} 平台。{2}如需管理這些設定的詳細資料,請前往 {3}。 Testlauf verwendet DLLs für Framework {0} und {1}-Plattform integriert. Folgende DLLs nicht Teil ausführen: {2} zur {3} Einzelheiten auf diese Einstellungen. diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/ProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/ProcessHelper.cs index 2fc77a24b9..2d07d938eb 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/ProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/ProcessHelper.cs @@ -103,6 +103,11 @@ public IntPtr GetProcessHandle(int processId) { throw new NotImplementedException(); } + + public object GetProcessById(int processId) + { + throw new NotImplementedException(); + } } } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/ProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/ProcessHelper.cs index 3dd13d8b7c..7cdb9c4799 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/ProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/ProcessHelper.cs @@ -109,6 +109,12 @@ public IntPtr GetProcessHandle(int processId) { throw new NotImplementedException(); } + + /// + public object GetProcessById(int processId) + { + throw new NotImplementedException(); + } } } diff --git a/src/package/nuspec/Microsoft.CodeCoverage.nuspec b/src/package/nuspec/Microsoft.CodeCoverage.nuspec index 3cbf4a1ddb..7028c2f603 100644 --- a/src/package/nuspec/Microsoft.CodeCoverage.nuspec +++ b/src/package/nuspec/Microsoft.CodeCoverage.nuspec @@ -32,6 +32,8 @@ + + diff --git a/src/package/nuspec/Microsoft.TestPlatform.TestHost.NetCore.props b/src/package/nuspec/Microsoft.TestPlatform.TestHost.NetCore.props index b57ffe1287..7dd28d882f 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.TestHost.NetCore.props +++ b/src/package/nuspec/Microsoft.TestPlatform.TestHost.NetCore.props @@ -11,6 +11,11 @@ PreserveNewest False + + Microsoft.TestPlatform.PlatformAbstractions.dll + PreserveNewest + False + @@ -23,5 +28,17 @@ PreserveNewest False + + Microsoft.TestPlatform.PlatformAbstractions.dll + PreserveNewest + False + + + + + Microsoft.TestPlatform.PlatformAbstractions.dll + PreserveNewest + False + \ No newline at end of file diff --git a/src/package/nuspec/TestPlatform.TestHost.nuspec b/src/package/nuspec/TestPlatform.TestHost.nuspec index a7b822e2d4..cfce5006b0 100644 --- a/src/package/nuspec/TestPlatform.TestHost.nuspec +++ b/src/package/nuspec/TestPlatform.TestHost.nuspec @@ -47,53 +47,45 @@ - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + diff --git a/src/package/sign/sign.proj b/src/package/sign/sign.proj index a1cf0dc0d5..67b7e8b404 100644 --- a/src/package/sign/sign.proj +++ b/src/package/sign/sign.proj @@ -389,8 +389,10 @@ + + @@ -402,8 +404,10 @@ + + diff --git a/src/testhost.x86/Program.cs b/src/testhost.x86/Program.cs index 1f9f5a4f70..f9bfb1ecca 100644 --- a/src/testhost.x86/Program.cs +++ b/src/testhost.x86/Program.cs @@ -8,6 +8,7 @@ namespace Microsoft.VisualStudio.TestPlatform.TestHost using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; + using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing; using Microsoft.VisualStudio.TestPlatform.ObjectModel; @@ -92,7 +93,7 @@ private static void WaitForDebuggerIfEnabled() { while (!IsDebuggerPresent()) { - System.Threading.Tasks.Task.Delay(1000).Wait(); + Task.Delay(1000).Wait(); } DebugBreak(); @@ -106,7 +107,7 @@ private static void WaitForDebuggerIfEnabled() { while (!Debugger.IsAttached) { - System.Threading.Tasks.Task.Delay(1000).Wait(); + Task.Delay(1000).Wait(); } Debugger.Break(); diff --git a/src/vstest.console/Processors/ParallelArgumentProcessor.cs b/src/vstest.console/Processors/ParallelArgumentProcessor.cs index 3fabaff5a9..149b65d313 100644 --- a/src/vstest.console/Processors/ParallelArgumentProcessor.cs +++ b/src/vstest.console/Processors/ParallelArgumentProcessor.cs @@ -133,7 +133,7 @@ public void Initialize(string argument) } commandLineOptions.Parallel = true; - this.runSettingsManager.UpdateRunSettingsNode(ParallelArgumentExecutor.RunSettingsPath, "0"); + this.runSettingsManager.UpdateRunSettingsNode(RunSettingsPath, "0"); } /// diff --git a/src/vstest.console/Program.cs b/src/vstest.console/Program.cs index 484f9f9a7a..972392f70d 100644 --- a/src/vstest.console/Program.cs +++ b/src/vstest.console/Program.cs @@ -4,7 +4,9 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine { using System; + using System.Diagnostics; using System.Globalization; + using System.Threading; using Microsoft.VisualStudio.TestPlatform.Utilities; /// @@ -29,12 +31,12 @@ public static int Main(string[] args) string.Format("Process Id: {0}, Name: {1}", currentProcess.Id, currentProcess.ProcessName), OutputLevel.Information); - while (!System.Diagnostics.Debugger.IsAttached) + while (!Debugger.IsAttached) { - System.Threading.Thread.Sleep(1000); + Thread.Sleep(1000); } - System.Diagnostics.Debugger.Break(); + Debugger.Break(); } SetCultureSpecifiedByUser(); diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 2543c3e99e..de08d3bece 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1670,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} - Neúspěšné: {1}, Úspěšné: {2}, Přeskočeno: {3}, Celkem: {4}, Doba trvání: {5} None - None + Žádné - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NÁZEV>=<HODNOTA> + Nastaví hodnotu proměnné prostředí. Pokud proměnná neexistuje, vytvoří ji, a pokud existuje, přepíše ji. Tato možnost bude znamenat, že se použije přepínač /InIsolation a vynutí se spuštění testů v izolovaném procesu. + + Tento argument se dá zadat vícekrát, může se tak poskytnout více proměnných. - Example: -e:VARIABLE1=VALUE1 - -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + Příklad: -e:PROMENNA1=HODNOTA1 + -e:JINA_PROMENNA="HODNOTA S MEZERAMI" + -e:JINA_PROMENNA="HODNOTA;oddělená;středníky" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + Proměnná prostředí {0} se už definovala, ale přepsal ji argument -Environment. diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 32f93332c0..1fad2bb789 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1670,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0}: Fehler: {1}, erfolgreich: {2}, übersprungen: {3}, gesamt: {4}, Dauer: {5} None - None + Keine - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NAME>=<VALUE> + Legt den Wert einer Umgebungsvariablen fest. Erstellt die Variable, wenn Sie nicht vorhanden ist, und setzt sie andernfalls außer Kraft. Dies impliziert die Option "/InIsolation" und erzwingt die Ausführung der Tests in einem isolierten Prozess. + + Dieses Argument kann mehrmals angegeben werden, um mehrere Variablen bereitzustellen. - Example: -e:VARIABLE1=VALUE1 - -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + Beispiel: -e:VARIABLE1=WERT1 + -e:WEITERE_VARIABLE="WERT MIT LEERZEICHEN" + -e:WEITERE_VARIABLE="WERT;getrennt durch;Semikolons" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + Die Umgebungsvariable "{0}" wurde bereits definiert, sie wird jedoch durch das Argument "-Environment" überschrieben. diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 98aaacac5e..c1fd1bf70e 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1673,17 +1673,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} - Con error: {1}, Superado: {2}, Omitido: {3}, Total: {4}, Duración: {5} None - None + Ninguno - {0} {1} - - {0} {1} + - {0} {1} @@ -1695,17 +1695,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NOMBRE>=<VALOR> + Establece el valor de una variable de entorno. Crea la variable si no existe o la reemplaza en caso de que exista. Esto implica el conmutador /InIsolation y fuerza la ejecución de las pruebas en un proceso aislado. + + Este argumento se puede especificar varias veces para proporcionar múltiples variables. - Example: -e:VARIABLE1=VALUE1 - -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + Ejemplo: -e:VARIABLE1=VALOR1 + -e:OTRA_VARIABLE="VALOR CON ESPACIOS" + -e:OTRA_VARIABLE="VALOR;separado por;puntoycoma" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + La variable de entorno "{0}" ya se definió, pero se reemplaza por el argumento -Environment. diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 52b7e9667a..ace6b4e480 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1670,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} - échec : {1}, réussite : {2}, ignorée(s) : {3}, total : {4}, durée : {5} None - None + Aucun(e) - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NOM>=<VALEUR> + Définit la valeur d'une variable d'environnement. Crée la variable si elle n'existe pas, et la remplace si elle existe. Cela implique l'utilisation du commutateur /InIsolation et l'exécution forcée des tests dans un processus isolé. + + Vous pouvez spécifier cet argument plusieurs fois pour fournir plusieurs variables. - Example: -e:VARIABLE1=VALUE1 - -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + Exemple : -e:VARIABLE1=VALEUR1 + -e:AUTRE_VARIABLE="VALEUR AVEC ESPACES" + -e:AUTRE_VARIABLE="VALEUR;séparée;par;des;points-virgules" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + La variable d'environnement '{0}' est déjà définie, mais elle est substituée par l'argument -Environment. diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 44dca81a9b..7f13229e8b 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1670,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} - Non superati: {1}. Superati: {2}. Ignorati: {3}. Totale: {4}. Durata: {5} None - None + Nessuno - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NOME>=<VALORE> + Imposta il valore di una variabile di ambiente. Crea la variabile se non esiste e la sostituisce se esiste. Implica l'opzione /InIsolation e forza l'esecuzione dei test in un processo isolato. + + È possibile specificare più volte questo argomento per fornire più variabili. - Example: -e:VARIABLE1=VALUE1 - -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + Esempio: -e:VARIABILE1=VALORE1 + -e:ALTRA_VARIABILE="VALORE CON SPAZI" + -e:ALTRA_VARIABILE="VALORE;delimitato da;punti e virgola" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + La variabile di ambiente '{0}' è già stata definita, ma viene sostituita dall'argomento -Environment. diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 8039796cc0..c32d7ce89d 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1670,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} -失敗: {1}、合格: {2}、スキップ: {3}、合計: {4}、期間: {5} None - None + なし - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NAME>=<VALUE> + 環境変数の値を設定します。変数が存在しない場合は作成され、存在する場合はオーバーライドされます。これにより、/InIsolation スイッチが暗黙に指定されるため、テストは強制的に分離プロセスで実行されます。 + + この引数は、複数の変数を指定するために複数回指定できます。 - Example: -e:VARIABLE1=VALUE1 + 例: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + 環境変数 '{0}' は既に定義されていますが、-Environment 引数でオーバーライドされます。 diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index a37ff745fa..7a4302b320 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1670,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} - 실패: {1}, 통과: {2}, 건너뜀: {3}, 전체: {4}, 기간: {5} None - None + 없음 - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NAME>=<VALUE> + 환경 변수의 값을 설정합니다. 변수가 없는 경우 변수를 만들고, 변수가 있으면 재정의합니다. 이는 /InIsolation 전환을 의미하며 격리된 프로세스에서 테스트를 강제로 실행합니다. + + 이 인수를 여러 번 지정하여 여러 변수를 제공할 수 있습니다. - Example: -e:VARIABLE1=VALUE1 + 예: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + 환경 변수 '{0}'이(가) 이미 정의되어 있지만 -Environment 인수로 재정의되었습니다. diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index 1270b0464b..1cd839c646 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1670,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} — niepowodzenie: {1}, powodzenie: {2}, pominięto: {3}, łącznie: {4}, czas trwania: {5} None - None + Brak - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NAME>=<VALUE> + Ustawia wartość zmiennej środowiskowej. Jeśli zmienna nie istnieje, tworzy ją, a w przeciwnym wypadku przesłania ją. Powoduje to określenie przełącznika /InIsolation i wymuszenie uruchomienia testów w procesie izolowanym. + + Ten argument może być określany wielokrotnie w celu dostarczenia wielu zmiennych. - Example: -e:VARIABLE1=VALUE1 - -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + Przykład: -e:ZMIENNA1=WARTOŚĆ1 + -e:INNA_ZMIENNA="WARTOŚĆ ZE SPACJAMI" + -e:INNA_ZMIENNA="WARTOŚCI;oddzielone;średnikami" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + Zmienna środowiskowa „{0}” została już zdefiniowana, ale została przysłonięta przez argument by-Environment. diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index efcce9c25c..d2c83ae37d 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1670,17 +1670,17 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} – Com falha: {1}, Aprovado: {2}, Ignorado: {3}, Total: {4}, Duração: {5} None - None + Nenhum - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NAME>=<VALUE> + Define o valor de uma variável de ambiente. Cria a variável caso ela não exista e substitui caso exista. Isso implicará a opção /InIsolation e forçará a execução dos testes em um processo isolado. + + Esse argumento pode ser especificado várias vezes para fornecer várias variáveis. - Example: -e:VARIABLE1=VALUE1 + Exemplo: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + -e:ANOTHER_VARIABLE="VALUE;seperado com;ponto e vírgula" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + A variável de ambiente '{0}' já foi definida, mas foi substituída por um argumento -Environment. diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index ff3b5d67fe..2ce7085194 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1670,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0}: не пройдено {1}, пройдено {2}, пропущено {3}, всего {4}, длительность {5}. None - None + Нет - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NAME>=<VALUE> + Устанавливает значение переменной среды. Если переменной среды не существует, она создается. Если переменная среды существует, она переопределяется. Этот параметр подразумевает использование параметра /InIsolation и принудительно выполняет тесты в изолированном процессе. + + Этот аргумент может быть указан несколько раз для нескольких переменных среды. - Example: -e:VARIABLE1=VALUE1 + Пример: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + Переменная среды "{0}" уже определена, но переопределена аргументом -Environment. diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 697efcc02d..2b6fca54da 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1670,17 +1670,17 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} - Başarısız: {1}, Başarılı: {2}, Atlanan: {3}, Toplam: {4}, Süre: {5} None - None + Hiçbiri - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment:<NAME>=<VALUE> + Bir ortam değişkeninin değerini ayarlar. Değişken mevcut değilse oluşturur, varsa geçersiz kılar. Bu, /InIsolation anahtarını kapsar ve testleri yalıtılmış bir işlemde çalıştırılmaya zorlar. + + Birden çok değişken sağlamak için bu bağımsız değişken birden çok kez belirtilebilir. - Example: -e:VARIABLE1=VALUE1 + Örnek: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + '{0}' ortam değişkeni zaten tanımlandı, ancak -Environment bağımsız değişkeni tarafından geçersiz kılındı. diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 8a13ccacb3..5ac2a800c8 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1670,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} - 失败: {1},通过: {2},已跳过: {3},总计: {4},持续时间: {5} None - None + - {0} {1} - - {0} {1} + - {0} {1} @@ -1692,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/环境:<NAME>=<VALUE> + 设置环境变量的值。如果该变量不存在,则创建它;如果它已存在,则替代它。这将表示 /InIsolation 开关并强制在隔离的进程中运行测试。 + + 可多次指定此参数来提供多个变量。 - Example: -e:VARIABLE1=VALUE1 + 示例: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + 环境变量“{0}”已定义,但它被 -Environment 参数替代。 diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index fd40f1d23e..11bd767f0c 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -227,8 +227,7 @@ 變更主控台記錄器的診斷等級前置詞,如下所示 範例: /logger:console;prefix=<預設為 "false"> - 主控台記錄器詳細資訊於此: https://aka.ms/console-logger - + 主控台記錄器詳細資訊於此: https://aka.ms/console-logger -Protokollierung | / Logger: < Logger Uri/FriendlyName > @@ -1671,17 +1670,17 @@ {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} - {0} - Failed: {1}, Passed: {2}, Skipped: {3}, Total: {4}, Duration: {5} + {0} - 失敗: {1},通過: {2},略過: {3},總計: {4},持續時間: {5} None - None + - {0} {1} - - {0} {1} + - {0} {1} @@ -1693,17 +1692,19 @@ Example: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" - -e|--Environment|/e|/Environment:<NAME>=<VALUE> - Sets the value of an environment variable. Creates the variable if one with the requested name does not exist. + -e|--Environment|/e|/Environment: <NAME>=<VALUE> + 設定環境變數的值。若變數不存在,則加以建立;若有則予以覆寫。這表示 /InIsolation 會在隔離流程中將測試切換並強制執行。 + + 此引數可供多次指定,以提供多項變數。 - Example: -e:VARIABLE1=VALUE1 + 範例: -e:VARIABLE1=VALUE1 -e:ANOTHER_VARIABLE="VALUE WITH SPACES" - -e:ANOTHER_VARIABLE="VALUE;seperated with;semi-columns" + -e:ANOTHER_VARIABLE="VALUE;seperated with;semicolons" Environment variable '{0}' was already defined, but it's overridden by -Environment argument. - Environment variable '{0}' was already defined, but it's overridden by -Environment argument. + 已定義環境變數 '{0}',但其已由 -Environment 引數覆寫。 diff --git a/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests.csproj b/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests.csproj index 3745707a45..4a2f963a12 100644 --- a/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests.csproj +++ b/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/DataCollectors/TraceDataCollector.UnitTests/DynamicCoverageDataCollectorImplTests.cs b/test/DataCollectors/TraceDataCollector.UnitTests/DynamicCoverageDataCollectorImplTests.cs index 65b3610833..4b1b3f182f 100644 --- a/test/DataCollectors/TraceDataCollector.UnitTests/DynamicCoverageDataCollectorImplTests.cs +++ b/test/DataCollectors/TraceDataCollector.UnitTests/DynamicCoverageDataCollectorImplTests.cs @@ -13,6 +13,8 @@ namespace Microsoft.VisualStudio.TraceDataCollector.UnitTests using Coverage.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; using TestPlatform.ObjectModel.DataCollection; using TraceCollector; using TraceCollector.Interfaces; @@ -36,6 +38,7 @@ public class DynamicCoverageDataCollectorImplTests private Mock dataCollectionLoggerMock; private Mock directoryHelperMock; private Mock fileHelperMock; + private Mock profilersLocationProviderMock; private string aConfigFileName; private string atempDirectory; @@ -48,8 +51,9 @@ public DynamicCoverageDataCollectorImplTests() this.dataCollectionLoggerMock = new Mock(); this.directoryHelperMock = new Mock(); this.fileHelperMock = new Mock(); + this.profilersLocationProviderMock = new Mock(); this.tempSessionDir = null; - this.collectorImpl = new DynamicCoverageDataCollectorImpl(this.vanguardMock.Object, this.directoryHelperMock.Object, this.fileHelperMock.Object); + this.collectorImpl = new DynamicCoverageDataCollectorImpl(this.vanguardMock.Object, this.directoryHelperMock.Object, this.fileHelperMock.Object, this.profilersLocationProviderMock.Object); this.SetupForInitialize(); this.collectorImpl.Initialize(DynamicCoverageDataCollectorImplTests.sampleConfigurationElement, this.dataCollectionSinkMock.Object, this.dataCollectionLoggerMock.Object); } @@ -83,6 +87,48 @@ public void InitializeShouldCreateDefaultCodeCoverageSettingsIfConfigElementIsNu this.CompareWithDefaultConfig(); } + [TestMethod] + public void InitializeShouldGenerateCodeCoverageDepsJsonFile() + { + this.directoryHelperMock.Setup(d => d.CreateDirectory(It.IsAny())) + .Callback((path) => Directory.CreateDirectory(path)); + + this.fileHelperMock.Setup(f => f.WriteAllText(It.IsAny(), It.IsAny())) + .Callback((path, content) => { File.WriteAllText(path, content); }); + + this.profilersLocationProviderMock.Setup(lp => lp.GetCodeCoverageShimPath()).Returns(@"C:\aaa\bbb\Microsoft.VisualStudio.CodeCoverage.Shim.dll"); + + this.collectorImpl.Initialize(null, this.dataCollectionSinkMock.Object, this.dataCollectionLoggerMock.Object); + + var obj = JObject.Parse(File.ReadAllText(this.collectorImpl.CodeCoverageDepsJsonFilePath)); + + var expected = @" +{ + ""runtimeTarget"": { + ""name"": ""codecoverage"", + ""signature"": """" + }, + ""targets"": { + ""codecoverage"": { + ""Microsoft.VisualStudio.CodeCoverage.Shim/15.0.0.0"": { + ""runtime"": { + ""C:/aaa/bbb/Microsoft.VisualStudio.CodeCoverage.Shim.dll"": { } + } + } + } + }, + ""libraries"": { + ""Microsoft.VisualStudio.CodeCoverage.Shim/15.0.0.0"": { + ""type"": ""reference"", + ""serviceable"": false, + ""sha512"": """" + } + } +}"; + + Assert.AreEqual(expected.Trim(), File.ReadAllText(this.collectorImpl.CodeCoverageDepsJsonFilePath).Trim()); + } + [TestMethod] public void InitializeShouldInitializeVanguardWithRightCoverageSettings() { @@ -382,8 +428,8 @@ private void CompareWithDefaultConfig() { Assert.AreEqual( DynamicCoverageDataCollectorImplTests.GetDefaultCodeCoverageConfig().Replace(" ", string.Empty) - .Replace(Environment.NewLine, string.Empty), - File.ReadAllText(this.aConfigFileName).Replace(" ", string.Empty).Replace(Environment.NewLine, string.Empty)); + .Replace("\r", string.Empty).Replace("\n", string.Empty), + File.ReadAllText(this.aConfigFileName).Replace(" ", string.Empty).Replace("\r", string.Empty).Replace("\n", string.Empty)); } private XmlNode ExtractNode(XmlNode node, string path) diff --git a/test/DataCollectors/TraceDataCollector.UnitTests/DynamicCoverageDataCollectorTests.cs b/test/DataCollectors/TraceDataCollector.UnitTests/DynamicCoverageDataCollectorTests.cs index 052a356202..a30769e1d1 100644 --- a/test/DataCollectors/TraceDataCollector.UnitTests/DynamicCoverageDataCollectorTests.cs +++ b/test/DataCollectors/TraceDataCollector.UnitTests/DynamicCoverageDataCollectorTests.cs @@ -29,6 +29,7 @@ public class DynamicCoverageDataCollectorTests x64 true false + false "; private const string ConfigWithClrIeEnabled = @@ -37,6 +38,7 @@ public class DynamicCoverageDataCollectorTests x64 true true + true "; private TestableDynamicCoverageDataCollector collector; @@ -66,6 +68,8 @@ public DynamicCoverageDataCollectorTests() this.vanguardLocationProviderMock.Setup(u => u.GetClrInstrumentationEngineX86Path()).Returns(@"clrie86"); this.vanguardLocationProviderMock.Setup(u => u.GetClrInstrumentationEngineX64Path()).Returns(@"clrie64"); + this.implMock.Setup(i => i.CodeCoverageDepsJsonFilePath).Returns(@"C:\temp\codecoverage.deps.json"); + this.environmentMock.Setup(e => e.OperatingSystem).Returns(PlatformOperatingSystem.Windows); var configElement = DynamicCoverageDataCollectorImplTests.CreateXmlElement(DynamicCoverageDataCollectorTests.DefaultConfig); this.collector.Initialize(configElement, this.eventsMock.Object, this.sinkMock.Object, this.loggerMock.Object, this.agentContextMock.Object); @@ -189,7 +193,8 @@ public void GetEnvironmentVariablesShouldReturnRightEnvVaribles() { "COR_ENABLE_PROFILING", "1" }, { "COR_PROFILER", "{E5F256DC-7959-4DD6-8E4F-C11150AB28E0}" }, { "MicrosoftInstrumentationEngine_ConfigPath32_VanguardInstrumentationProfiler", "config86" }, - { "MicrosoftInstrumentationEngine_ConfigPath64_VanguardInstrumentationProfiler", "config64" } + { "MicrosoftInstrumentationEngine_ConfigPath64_VanguardInstrumentationProfiler", "config64" }, + { "VANGUARD_DOTNET_ADDITIONAL_DEPS", @"C:\temp\codecoverage.deps.json" }, }; this.implMock.Setup(i => i.GetSessionName()).Returns("MTM_123"); @@ -222,6 +227,7 @@ public void GetEnvironmentVariablesShouldReturnRightEnvVariblesClrInstrumentatio { "MicrosoftInstrumentationEngine_LogLevel_{2A1F2A34-8192-44AC-A9D8-4FCC03DCBAA8}", "Errors" }, { "MicrosoftInstrumentationEngine_DisableCodeSignatureValidation", "1" }, { "MicrosoftInstrumentationEngine_FileLogPath", @"GENERATED" }, + { "VANGUARD_DOTNET_ADDITIONAL_DEPS", @"C:\temp\codecoverage.deps.json" } }; this.implMock.Setup(i => i.GetSessionName()).Returns("MTM_123"); @@ -257,6 +263,7 @@ public void GetEnvironmentVariablesShouldReturnRightEnvVariblesClrInstrumentatio { "MicrosoftInstrumentationEngine_LogLevel_{2A1F2A34-8192-44AC-A9D8-4FCC03DCBAA8}", "Errors" }, { "MicrosoftInstrumentationEngine_DisableCodeSignatureValidation", "1" }, { "MicrosoftInstrumentationEngine_FileLogPath", @"GENERATED" }, + { "VANGUARD_DOTNET_ADDITIONAL_DEPS", @"C:\temp\codecoverage.deps.json" } }; this.implMock.Setup(i => i.GetSessionName()).Returns("MTM_123"); @@ -288,7 +295,7 @@ public void GetEnvironmentVariablesShouldReturnRightEnvVariblesClrInstrumentatio { "MicrosoftInstrumentationEngine_LogLevel", "Errors" }, { "MicrosoftInstrumentationEngine_LogLevel_{2A1F2A34-8192-44AC-A9D8-4FCC03DCBAA8}", "Errors" }, { "MicrosoftInstrumentationEngine_DisableCodeSignatureValidation", "1" }, - { "MicrosoftInstrumentationEngine_FileLogPath", @"GENERATED" }, + { "MicrosoftInstrumentationEngine_FileLogPath", @"GENERATED" } }; this.implMock.Setup(i => i.GetSessionName()).Returns("MTM_123"); @@ -324,6 +331,7 @@ public void GetEnvironmentVariablesShouldReturnRightEnvVariblesClrInstrumentatio { "MicrosoftInstrumentationEngine_LogLevel_{2A1F2A34-8192-44AC-A9D8-4FCC03DCBAA8}", "Errors" }, { "MicrosoftInstrumentationEngine_DisableCodeSignatureValidation", "1" }, { "MicrosoftInstrumentationEngine_FileLogPath", @"GENERATED" }, + { "VANGUARD_DOTNET_ADDITIONAL_DEPS", @"C:\temp\codecoverage.deps.json" } }; this.implMock.Setup(i => i.GetSessionName()).Returns("MTM_123"); diff --git a/test/DataCollectors/TraceDataCollector.UnitTests/Microsoft.TestPlatform.TraceDataCollector.UnitTests.csproj b/test/DataCollectors/TraceDataCollector.UnitTests/Microsoft.TestPlatform.TraceDataCollector.UnitTests.csproj index 493f36aa2a..c38d997b27 100644 --- a/test/DataCollectors/TraceDataCollector.UnitTests/Microsoft.TestPlatform.TraceDataCollector.UnitTests.csproj +++ b/test/DataCollectors/TraceDataCollector.UnitTests/Microsoft.TestPlatform.TraceDataCollector.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/DataCollectors/TraceDataCollector.UnitTests/ProfilersLocationProviderTests.cs b/test/DataCollectors/TraceDataCollector.UnitTests/ProfilersLocationProviderTests.cs index 521728b2c7..74a3c46ac1 100644 --- a/test/DataCollectors/TraceDataCollector.UnitTests/ProfilersLocationProviderTests.cs +++ b/test/DataCollectors/TraceDataCollector.UnitTests/ProfilersLocationProviderTests.cs @@ -10,6 +10,7 @@ namespace Microsoft.VisualStudio.TraceDataCollector.UnitTests using TraceCollector; [TestClass] + [TestCategory("Windows")] public class ProfilersLocationProviderTests { private ProfilersLocationProvider vanguardLocationProvider; @@ -66,6 +67,14 @@ public void GetVanguardProfilerConfigX64PathShouldReturnRightDirectory() Assert.AreEqual(Path.Join(this.GetCurrentAssemblyLocation(), @"CodeCoverage\amd64\VanguardInstrumentationProfiler_x64.config"), actualPath); } + [TestMethod] + public void GetCodeCoverageShimPathShouldReturnRightDirectory() + { + var actualPath = this.vanguardLocationProvider.GetCodeCoverageShimPath(); + + Assert.AreEqual(Path.Join(this.GetCurrentAssemblyLocation(), @"CodeCoverage\coreclr\Microsoft.VisualStudio.CodeCoverage.Shim.dll"), actualPath); + } + [TestMethod] public void GetClrInstrumentationEngineX86PathShouldReturnRightDirectory() { diff --git a/test/DataCollectors/TraceDataCollector.UnitTests/VanguardTests.cs b/test/DataCollectors/TraceDataCollector.UnitTests/VanguardTests.cs index fc2f6b98b7..e4d567e866 100644 --- a/test/DataCollectors/TraceDataCollector.UnitTests/VanguardTests.cs +++ b/test/DataCollectors/TraceDataCollector.UnitTests/VanguardTests.cs @@ -21,6 +21,7 @@ namespace Microsoft.VisualStudio.TraceDataCollector.UnitTests using TraceCollector.Interfaces; [TestClass] + [TestCategory("Windows")] public class VanguardTests { private const string CodeCoverageExeFileName = "CodeCoverage"; diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Microsoft.TestPlatform.AcceptanceTests.csproj b/test/Microsoft.TestPlatform.AcceptanceTests/Microsoft.TestPlatform.AcceptanceTests.csproj index 6cd58d9ec6..3afe883253 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Microsoft.TestPlatform.AcceptanceTests.csproj +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Microsoft.TestPlatform.AcceptanceTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/DiscoverTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/DiscoverTests.cs index f62ebd9e28..886389e4e9 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/DiscoverTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/DiscoverTests.cs @@ -172,7 +172,8 @@ public void DiscoverTestsUsingSourceNavigation(RunnerInfo runnerInfo) } [TestMethod] - [NetFullTargetFrameworkDataSource] + // flaky on the desktop runner, desktop framework combo + [NetFullTargetFrameworkDataSource(useDesktopRunner: false)] [NetCoreTargetFrameworkDataSource] public void CancelTestDiscovery(RunnerInfo runnerInfo) { diff --git a/test/Microsoft.TestPlatform.Build.UnitTests/Microsoft.TestPlatform.Build.UnitTests.csproj b/test/Microsoft.TestPlatform.Build.UnitTests/Microsoft.TestPlatform.Build.UnitTests.csproj index 49d314f50c..e1d3b67bfb 100644 --- a/test/Microsoft.TestPlatform.Build.UnitTests/Microsoft.TestPlatform.Build.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Build.UnitTests/Microsoft.TestPlatform.Build.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/Microsoft.TestPlatform.Client.UnitTests.csproj b/test/Microsoft.TestPlatform.Client.UnitTests/Microsoft.TestPlatform.Client.UnitTests.csproj index 7de9a22657..2a9ca74a04 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/Microsoft.TestPlatform.Client.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Client.UnitTests/Microsoft.TestPlatform.Client.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs index 601b439a6c..a9fe291f15 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs @@ -4,6 +4,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.UnitTests { using System; + using System.IO; using System.Collections.Generic; using Microsoft.VisualStudio.TestPlatform.Client.Execution; @@ -178,7 +179,8 @@ public void CreateTestRunRequestShouldUpdateLoggerExtensionWhenDesingModeIsFalse "; - var testRunCriteria = new TestRunCriteria(new List { @"x:dummy\foo.dll" }, 10, false, settingsXml, TimeSpan.Zero); + var temp = Path.GetTempPath(); + var testRunCriteria = new TestRunCriteria(new List { $@"{temp}foo.dll" }, 10, false, settingsXml, TimeSpan.Zero); this.hostManager.Setup(hm => hm.GetTestSources(testRunCriteria.Sources)) .Returns(testRunCriteria.Sources); @@ -209,7 +211,7 @@ public void CreateTestRunRequestShouldUpdateLoggerExtensionWhenDesignModeIsFalse "; - var testRunCriteria = new TestRunCriteria(new List { new TestCase("dll1.class1.test1", new Uri("hello://x/"), "xyz\\1.dll") }, 10, false, settingsXml); + var testRunCriteria = new TestRunCriteria(new List { new TestCase("dll1.class1.test1", new Uri("hello://x/"), $"xyz{Path.DirectorySeparatorChar}1.dll") }, 10, false, settingsXml); this.testEngine.Setup(te => te.GetExecutionManager(this.mockRequestData.Object, this.hostManager.Object, It.IsAny())).Returns(this.executionManager.Object); this.testEngine.Setup(te => te.GetExtensionManager()).Returns(this.extensionManager.Object); @@ -238,9 +240,9 @@ public void CreateTestRunRequestShouldNotUpdateTestSourcesIfSelectedTestAreRun() "; - var testRunCriteria = new TestRunCriteria(new List { new TestCase("dll1.class1.test1", new Uri("hello://x/"), "xyz\\1.dll") }, 10, false, settingsXml); + var testRunCriteria = new TestRunCriteria(new List { new TestCase("dll1.class1.test1", new Uri("hello://x/"), $"xyz{Path.DirectorySeparatorChar}1.dll") }, 10, false, settingsXml); this.hostManager.Setup(hm => hm.GetTestSources(It.IsAny>())) - .Returns(new List { "xyz\\1.dll" }); + .Returns(new List { $"xyz{Path.DirectorySeparatorChar}1.dll" }); this.testEngine.Setup(te => te.GetExecutionManager(this.mockRequestData.Object, this.hostManager.Object, It.IsAny())).Returns(this.executionManager.Object); this.testEngine.Setup(te => te.GetExtensionManager()).Returns(this.extensionManager.Object); @@ -390,7 +392,8 @@ public void CreateDiscoveryRequestShouldUpdateLoggerExtensionWhenDesignModeIsFal "; - var discoveryCriteria = new DiscoveryCriteria(new List { @"x:dummy\foo.dll" }, 1, settingsXml); + var temp = Path.GetTempPath(); + var discoveryCriteria = new DiscoveryCriteria(new List { $@"{temp}foo.dll" }, 1, settingsXml); this.hostManager.Setup(hm => hm.GetTestSources(discoveryCriteria.Sources)) .Returns(discoveryCriteria.Sources); diff --git a/test/Microsoft.TestPlatform.Common.PlatformTests/Microsoft.TestPlatform.Common.PlatformTests.csproj b/test/Microsoft.TestPlatform.Common.PlatformTests/Microsoft.TestPlatform.Common.PlatformTests.csproj index 418feabfab..69354e500b 100644 --- a/test/Microsoft.TestPlatform.Common.PlatformTests/Microsoft.TestPlatform.Common.PlatformTests.csproj +++ b/test/Microsoft.TestPlatform.Common.PlatformTests/Microsoft.TestPlatform.Common.PlatformTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/DataCollectorExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/DataCollectorExtensionManagerTests.cs index de7ab0778f..00e193f6f7 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/DataCollectorExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/DataCollectorExtensionManagerTests.cs @@ -5,8 +5,7 @@ namespace Microsoft.TestPlatform.Common.UnitTests.ExtensionFramework { using System; - using global::TestPlatform.Common.UnitTests.ExtensionFramework; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -17,7 +16,7 @@ public class DataCollectorExtensionManagerTests [TestInitialize] public void Initialize() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(DataCollectorExtensionManagerTests)); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs index b7495ad485..411f792a34 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs @@ -6,7 +6,8 @@ namespace TestPlatform.Common.UnitTests.ExtensionFramework using System.Collections.Generic; using System.Linq; using System.Reflection; - + using Microsoft.TestPlatform.Common; + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.Utilities; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -23,7 +24,7 @@ public void TestCleanup() [TestMethod] public void CreateShouldDiscoverDiscovererExtensions() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestDiscoveryExtensionManagerTests)); var extensionManager = TestDiscoveryExtensionManager.Create(); @@ -34,7 +35,7 @@ public void CreateShouldDiscoverDiscovererExtensions() [TestMethod] public void CreateShouldCacheDiscoveredExtensions() { - TestPluginCacheTests.SetupMockExtensions(() => { }); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestDiscoveryExtensionManagerTests), () => { }); var extensionManager = TestDiscoveryExtensionManager.Create(); TestDiscoveryExtensionManager.Create(); @@ -59,7 +60,7 @@ public void GetDiscoveryExtensionManagerShouldReturnADiscoveryManagerWithExtensi [TestMethod] public void LoadAndInitializeShouldInitializeAllExtensions() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestDiscoveryExtensionManagerTests)); TestDiscoveryExtensionManager.LoadAndInitializeAllExtensions(false); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs index f77b1fbdfa..67e77f94f7 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs @@ -8,6 +8,8 @@ namespace TestPlatform.Common.UnitTests.ExtensionFramework using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Reflection; + using Microsoft.TestPlatform.TestUtilities; + [TestClass] public class TestExecutorExtensionManagerTests { @@ -20,7 +22,7 @@ public void TestCleanup() [TestMethod] public void CreateShouldDiscoverExecutorExtensions() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestExecutorExtensionManagerTests)); var extensionManager = TestExecutorExtensionManager.Create(); @@ -31,7 +33,7 @@ public void CreateShouldDiscoverExecutorExtensions() [TestMethod] public void CreateShouldCacheDiscoveredExtensions() { - TestPluginCacheTests.SetupMockExtensions(() => { }); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestExecutorExtensionManagerTests), () => { }); var extensionManager = TestExecutorExtensionManager.Create(); TestExecutorExtensionManager.Create(); @@ -56,7 +58,7 @@ public void GetExecutorExtensionManagerShouldReturnAnExecutionManagerWithExtensi [TestMethod] public void LoadAndInitializeShouldInitializeAllExtensions() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestExecutorExtensionManagerTests)); TestExecutorExtensionManager.LoadAndInitializeAllExtensions(false); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExtensionManagerTests.cs index cfbec727a3..b435a94171 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExtensionManagerTests.cs @@ -5,7 +5,7 @@ namespace TestPlatform.Common.UnitTests.ExtensionFramework { using System; using System.Collections.Generic; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities; @@ -26,7 +26,7 @@ public class TestExtensionManagerTests public TestExtensionManagerTests() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestExtensionManagerTests)); messageLogger = TestSessionMessageLogger.Instance; TestPluginManager.Instance.GetSpecificTestExtensions (TestPlatformConstants.TestLoggerEndsWithPattern, out unfilteredTestExtensions, out filteredTestExtensions); @@ -63,7 +63,7 @@ public void TryGetTestExtensionShouldReturnExtensionWithCorrectUri() public void TryGetTestExtensionShouldThrowExceptionWithNullUri() { testExtensionManager = new DummyTestExtensionManager(unfilteredTestExtensions, filteredTestExtensions, messageLogger); - TestPluginCacheTests.SetupMockAdditionalPathExtensions(); + TestPluginCacheHelper.SetupMockAdditionalPathExtensions(typeof(TestExtensionManagerTests)); Assert.ThrowsException(() => { var result = testExtensionManager.TryGetTestExtension(default(Uri)); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestLoggerExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestLoggerExtensionManagerTests.cs index 6f362560b1..09acb74db2 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestLoggerExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestLoggerExtensionManagerTests.cs @@ -3,6 +3,7 @@ namespace TestPlatform.Common.UnitTests.ExtensionFramework { + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -14,7 +15,7 @@ public class TestLoggerExtensionManagerTests [TestInitialize] public void Initialize() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestLoggerExtensionManagerTests)); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs index d30b1ec948..c3e7af0ee1 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs @@ -8,7 +8,7 @@ namespace TestPlatform.Common.UnitTests.ExtensionFramework using System.IO; using System.Linq; using System.Reflection; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities; @@ -266,12 +266,13 @@ public void GetResolutionPathsShouldThrowIfExtensionAssemblyIsNull() [TestMethod] public void GetResolutionPathsShouldReturnExtensionAssemblyDirectoryAndTPCommonDirectory() { - var resolutionPaths = TestPluginCache.Instance.GetResolutionPaths(@"C:\temp\Idonotexist.dll"); + var temp = Path.GetTempPath(); + var resolutionPaths = TestPluginCache.Instance.GetResolutionPaths($@"{temp}{Path.DirectorySeparatorChar}Idonotexist.dll").Select(p => p.Replace("/", "\\")).ToList(); var tpCommonDirectory = Path.GetDirectoryName(typeof(TestPluginCache).GetTypeInfo().Assembly.Location); - var expectedPaths = new List { "C:\\temp", tpCommonDirectory }; + var expectedPaths = new List { temp, tpCommonDirectory }.Select(p => p.Replace("/", "\\").TrimEnd('\\')).ToList(); - CollectionAssert.AreEqual(expectedPaths, resolutionPaths.ToList()); + CollectionAssert.AreEqual(expectedPaths, resolutionPaths, $"Collection {string.Join(", ", resolutionPaths)}, is not equal to the expected collection {string.Join(", ", expectedPaths)}."); } [TestMethod] @@ -293,7 +294,7 @@ public void GetResolutionPathsShouldNotHaveDuplicatePathsIfExtensionIsInSameDire [TestMethod] public void GetTestExtensionsShouldReturnExtensionsInAssembly() { - SetupMockAdditionalPathExtensions(); + TestPluginCacheHelper.SetupMockAdditionalPathExtensions(typeof(TestPluginCacheTests)); TestPluginCache.Instance.GetTestExtensions(typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location); @@ -344,7 +345,7 @@ public void GetTestExtensionsShouldShouldThrowIfDiscovererThrows() [TestMethod] public void DiscoverTestExtensionsShouldDiscoverExtensionsFromExtensionsFolder() { - SetupMockAdditionalPathExtensions(); + TestPluginCacheHelper.SetupMockAdditionalPathExtensions(typeof(TestPluginCacheTests)); TestPluginCache.Instance.DiscoverTestExtensions(TestPlatformConstants.TestAdapterEndsWithPattern); @@ -357,7 +358,7 @@ public void DiscoverTestExtensionsShouldDiscoverExtensionsFromExtensionsFolder() [TestMethod] public void DiscoverTestExtensionsShouldSetCachedBoolToTrue() { - SetupMockAdditionalPathExtensions(); + TestPluginCacheHelper.SetupMockAdditionalPathExtensions(typeof(TestPluginCacheTests)); TestPluginCache.Instance.DiscoverTestExtensions(TestPlatformConstants.TestAdapterEndsWithPattern); @@ -367,63 +368,6 @@ public void DiscoverTestExtensionsShouldSetCachedBoolToTrue() #endregion - #region Setup mocks - - public static TestableTestPluginCache SetupMockAdditionalPathExtensions() - { - return SetupMockAdditionalPathExtensions( - new string[] { typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location }); - } - - public static TestableTestPluginCache SetupMockAdditionalPathExtensions(string[] extensions) - { - var mockFileHelper = new Mock(); - var testPluginCache = new TestableTestPluginCache(); - - TestPluginCache.Instance = testPluginCache; - - // Stub the default extensions folder. - mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(false); - - TestPluginCache.Instance.UpdateExtensions(extensions, true); - - return testPluginCache; - } - - public static void SetupMockExtensions(Mock mockFileHelper = null) - { - SetupMockExtensions(() => { }, mockFileHelper); - } - - public static void SetupMockExtensions(Action callback, Mock mockFileHelper = null) - { - SetupMockExtensions(new[] { typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location }, callback, mockFileHelper); - } - - public static void SetupMockExtensions(string[] extensions, Action callback, Mock mockFileHelper = null) - { - // Setup mocks. - if (mockFileHelper == null) - { - mockFileHelper = new Mock(); - } - - mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); - - var testableTestPluginCache = new TestableTestPluginCache(extensions.ToList()); - testableTestPluginCache.Action = callback; - - // Setup the testable instance. - TestPluginCache.Instance = testableTestPluginCache; - } - - public static void ResetExtensionsCache() - { - TestPluginCache.Instance = null; - SettingsProviderExtensionManager.Destroy(); - } - - #endregion private void InvokeGetExtensionPaths(List expectedExtensions, bool skipDefaultExtensions) { @@ -436,36 +380,5 @@ private void InvokeGetExtensionPaths(List expectedExtensions, bool skipD CollectionAssert.AreEquivalent(expectedExtensions, extensions); } } - - #region Testable implementation - - public class TestableTestPluginCache : TestPluginCache - { - public Action Action; - public TestableTestPluginCache(List extensionsPath) - { - TestDiscoveryExtensionManager.Destroy(); - TestExecutorExtensionManager.Destroy(); - SettingsProviderExtensionManager.Destroy(); - this.UpdateExtensions(extensionsPath, skipExtensionFilters: false); - } - - public TestableTestPluginCache() : this(new List()) - { - } - - protected override IEnumerable GetFilteredExtensions(List extensions, string searchPattern) - { - this.Action?.Invoke(); - return extensions; - } - - new public void SetupAssemblyResolver(string extensionAssembly) - { - base.SetupAssemblyResolver(extensionAssembly); - } - } - - #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs index 2ebf2ec23a..13ae20fffe 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs @@ -7,7 +7,7 @@ namespace TestPlatform.Common.UnitTests.ExtensionFramework using System.Collections.Generic; using System.Linq; using System.Reflection; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities; @@ -69,7 +69,7 @@ public void InstanceShouldReturnCachedTestPluginManagerInstance() [TestMethod] public void GetTestExtensionsShouldReturnTestDiscovererExtensions() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestPluginManagerTests)); IEnumerable>> unfilteredTestExtensions; IEnumerable> testExtensions; @@ -88,7 +88,7 @@ public void GetTestExtensionsShouldReturnTestDiscovererExtensions() public void GetTestExtensionsShouldDiscoverExtensionsOnlyOnce() { var discoveryCount = 0; - TestPluginCacheTests.SetupMockExtensions(() => { discoveryCount++; }); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestPluginManagerTests), () => { discoveryCount++; }); IEnumerable>> unfilteredTestExtensions; IEnumerable> testExtensions; diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs index ffb741dbed..114bcf4b7b 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs @@ -4,7 +4,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors.Utilities { using System; - using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -16,8 +15,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors.U [TestClass] public class RunSettingsProviderExtensionsTests { - private const string DefaultRunSettingsTemplate = - "\r\n \r\n %ResultsDirectory%\r\n X86\r\n %DefaultFramework%\r\n \r\n"; private IRunSettingsProvider runSettingsProvider; [TestInitialize] @@ -29,7 +26,12 @@ public void Init() [TestMethod] public void UpdateRunSettingsShouldUpdateGivenSettingsXml() { - const string runSettingsXml = "\r\n \r\n X86\r\n \r\n"; + string runSettingsXml = string.Join(Environment.NewLine, + "", + " ", + " X86", + " ", + ""); this.runSettingsProvider.UpdateRunSettings(runSettingsXml); @@ -62,7 +64,8 @@ public void AddDefaultRunSettingsShouldSetDefaultSettingsForEmptySettings() { this.runSettingsProvider.AddDefaultRunSettings(); - var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(this.runSettingsProvider.ActiveRunSettings.SettingsXml); + var runConfiguration = + XmlRunSettingsUtilities.GetRunConfigurationNode(this.runSettingsProvider.ActiveRunSettings.SettingsXml); Assert.AreEqual(runConfiguration.ResultsDirectory, Constants.DefaultResultsDirectory); Assert.AreEqual(runConfiguration.TargetFramework.ToString(), Framework.DefaultFramework.ToString()); Assert.AreEqual(runConfiguration.TargetPlatform, Constants.DefaultPlatform); @@ -71,11 +74,17 @@ public void AddDefaultRunSettingsShouldSetDefaultSettingsForEmptySettings() [TestMethod] public void AddDefaultRunSettingsShouldAddUnspecifiedSettings() { - this.runSettingsProvider.UpdateRunSettings("\r\n \r\n X86\r\n \r\n"); + this.runSettingsProvider.UpdateRunSettings(string.Join(Environment.NewLine, + "", + " ", + " X86", + " ", + "")); this.runSettingsProvider.AddDefaultRunSettings(); - var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(this.runSettingsProvider.ActiveRunSettings.SettingsXml); + var runConfiguration = + XmlRunSettingsUtilities.GetRunConfigurationNode(this.runSettingsProvider.ActiveRunSettings.SettingsXml); Assert.AreEqual(runConfiguration.ResultsDirectory, Constants.DefaultResultsDirectory); Assert.AreEqual(runConfiguration.TargetFramework.ToString(), Framework.DefaultFramework.ToString()); } @@ -83,49 +92,59 @@ public void AddDefaultRunSettingsShouldAddUnspecifiedSettings() [TestMethod] public void AddDefaultRunSettingsShouldNotChangeSpecifiedSettings() { - - this.runSettingsProvider.UpdateRunSettings("\r\n \r\n X64\r\n \r\n"); + this.runSettingsProvider.UpdateRunSettings(string.Join(Environment.NewLine, + "", + " ", + " X64 ", + "")); this.runSettingsProvider.AddDefaultRunSettings(); - var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(this.runSettingsProvider.ActiveRunSettings.SettingsXml); + var runConfiguration = + XmlRunSettingsUtilities.GetRunConfigurationNode(this.runSettingsProvider.ActiveRunSettings.SettingsXml); Assert.AreEqual(runConfiguration.TargetPlatform, Architecture.X64); } [TestMethod] public void AddDefaultRunSettingsShouldThrowExceptionIfArgumentIsNull() { - Assert.ThrowsException(() => RunSettingsProviderExtensions.AddDefaultRunSettings(null)); + Assert.ThrowsException(() => + RunSettingsProviderExtensions.AddDefaultRunSettings(null)); } [TestMethod] public void UpdateRunSettingsNodeShouldThrowExceptionIfKeyIsNull() { - Assert.ThrowsException(() => this.runSettingsProvider.UpdateRunSettingsNode(null, "data")); + Assert.ThrowsException(() => + this.runSettingsProvider.UpdateRunSettingsNode(null, "data")); } [TestMethod] public void UpdateRunSettingsNodeShouldThrowExceptionIfKeyIsEmptyOrWhiteSpace() { - Assert.ThrowsException(() => this.runSettingsProvider.UpdateRunSettingsNode(" ", "data")); + Assert.ThrowsException(() => + this.runSettingsProvider.UpdateRunSettingsNode(" ", "data")); } [TestMethod] public void UpdateRunSettingsNodeShouldThrowExceptionIfDataIsNull() { - Assert.ThrowsException(() => this.runSettingsProvider.UpdateRunSettingsNode("Key", null)); + Assert.ThrowsException(() => + this.runSettingsProvider.UpdateRunSettingsNode("Key", null)); } [TestMethod] public void UpdateRunSettingsNodeShouldThrowExceptionIfRunSettingsProviderIsNull() { - Assert.ThrowsException(() => RunSettingsProviderExtensions.UpdateRunSettingsNode(null, "Key", "data")); + Assert.ThrowsException(() => + RunSettingsProviderExtensions.UpdateRunSettingsNode(null, "Key", "data")); } [TestMethod] public void UpdateRunSettingsNodeShouldAddNewKeyIfNotPresent() { - this.runSettingsProvider.UpdateRunSettings(" "); + this.runSettingsProvider.UpdateRunSettings( + " "); this.runSettingsProvider.UpdateRunSettingsNode("Key.Path", "data"); Assert.AreEqual("data", this.runSettingsProvider.QueryRunSettingsNode("Key.Path")); @@ -140,14 +159,28 @@ public void UpdateTestRunParameterSettingsNodeShouldAddNewKeyIfNotPresent() [TestMethod] public void UpdateTetsRunParameterSettingsNodeShouldOverrideValueIfKeyIsAlreadyPresent() { - var runSettingsWithTestRunParameters = "\r\n\r\n \r\n \r\n \r\n"; - var runSettingsWithTestRunParametersOverrode = "\r\n\r\n \r\n \r\n \r\n"; + var runSettingsWithTestRunParameters = string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + ""); + var runSettingsWithTestRunParametersOverrode = string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + ""); this.runSettingsProvider.UpdateRunSettings(runSettingsWithTestRunParameters); - var match = this.runSettingsProvider.GetTestRunParameterNodeMatch("TestRunParameters.Parameter(name=\"weburl\",value=\"http://localhost//def\")"); + var match = this.runSettingsProvider.GetTestRunParameterNodeMatch( + "TestRunParameters.Parameter(name=\"weburl\",value=\"http://localhost//def\")"); this.runSettingsProvider.UpdateTestRunParameterSettingsNode(match); - Assert.AreEqual(runSettingsWithTestRunParametersOverrode, this.runSettingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(runSettingsWithTestRunParametersOverrode, + this.runSettingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] @@ -171,7 +204,8 @@ public void TestRunParameterSettingsNodeCanMixSpecialCharacters() [TestMethod] public void UpdateRunSettingsNodeShouldUpdateKeyIfAlreadyPresent() { - this.runSettingsProvider.UpdateRunSettings(" 1 "); + this.runSettingsProvider.UpdateRunSettings( + " 1 "); this.runSettingsProvider.UpdateRunSettingsNode("RunConfiguration.MaxCpuCount", "0"); Assert.AreEqual("0", this.runSettingsProvider.QueryRunSettingsNode("RunConfiguration.MaxCpuCount")); } @@ -179,31 +213,36 @@ public void UpdateRunSettingsNodeShouldUpdateKeyIfAlreadyPresent() [TestMethod] public void UpdateRunSettingsNodeInnerXmlShouldThrowExceptionIfKeyIsNull() { - Assert.ThrowsException(() => this.runSettingsProvider.UpdateRunSettingsNodeInnerXml(null, "")); + Assert.ThrowsException(() => + this.runSettingsProvider.UpdateRunSettingsNodeInnerXml(null, "")); } [TestMethod] public void UpdateRunSettingsNodeInnerXmlShouldThrowExceptionIfKeyIsEmptyOrWhiteSpace() { - Assert.ThrowsException(() => this.runSettingsProvider.UpdateRunSettingsNodeInnerXml(" ", "")); + Assert.ThrowsException(() => + this.runSettingsProvider.UpdateRunSettingsNodeInnerXml(" ", "")); } [TestMethod] public void UpdateRunSettingsNodeInnerXmlShouldThrowExceptionIfXmlIsNull() { - Assert.ThrowsException(() => this.runSettingsProvider.UpdateRunSettingsNodeInnerXml("Key", null)); + Assert.ThrowsException(() => + this.runSettingsProvider.UpdateRunSettingsNodeInnerXml("Key", null)); } [TestMethod] public void UpdateRunSettingsNodeInnerXmlShouldThrowExceptionIfRunSettingsProviderIsNull() { - Assert.ThrowsException(() => RunSettingsProviderExtensions.UpdateRunSettingsNodeInnerXml(null, "Key", "")); + Assert.ThrowsException(() => + RunSettingsProviderExtensions.UpdateRunSettingsNodeInnerXml(null, "Key", "")); } [TestMethod] public void UpdateRunSettingsNodeInnerXmlShouldAddNewKeyIfNotPresent() { - this.runSettingsProvider.UpdateRunSettings(" "); + this.runSettingsProvider.UpdateRunSettings( + " "); this.runSettingsProvider.UpdateRunSettingsNodeInnerXml("Key.Path", "myxml"); Assert.AreEqual("myxml", this.runSettingsProvider.QueryRunSettingsNode("Key.Path")); @@ -212,7 +251,8 @@ public void UpdateRunSettingsNodeInnerXmlShouldAddNewKeyIfNotPresent() [TestMethod] public void UpdateRunSettingsNodeInnerXmlShouldUpdateKeyIfAlreadyPresent() { - this.runSettingsProvider.UpdateRunSettings(" 1 "); + this.runSettingsProvider.UpdateRunSettings( + " 1 "); this.runSettingsProvider.UpdateRunSettingsNodeInnerXml("RunConfiguration", "0"); Assert.AreEqual("0", this.runSettingsProvider.QueryRunSettingsNode("RunConfiguration.MaxCpuCount")); } @@ -238,7 +278,8 @@ public void QueryRunSettingsNodeShouldReturnNullForNotExistKey() [TestMethod] public void QueryRunSettingsNodeShouldReturnCorrectValue() { - this.runSettingsProvider.UpdateRunSettings(" x86 "); + this.runSettingsProvider.UpdateRunSettings( + " x86 "); Assert.AreEqual("x86", this.runSettingsProvider.QueryRunSettingsNode("RunConfiguration.TargetPlatform")); } @@ -263,15 +304,12 @@ private void CheckRunSettingsAreUpdated(string parameterName, string parameterVa private class TestableRunSettingsProvider : IRunSettingsProvider { - public RunSettings ActiveRunSettings - { - get; - set; - } + public RunSettings ActiveRunSettings { get; set; } + public void SetActiveRunSettings(RunSettings runSettings) { this.ActiveRunSettings = runSettings; } } } -} +} \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostExtensionManagerTests.cs index d6ac9d856d..abc9041083 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostExtensionManagerTests.cs @@ -3,11 +3,11 @@ namespace TestPlatform.Common.UnitTests.Logging { + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.Hosting; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; - using TestPlatform.Common.UnitTests.ExtensionFramework; [TestClass] public class TestHostExtensionManagerTests @@ -15,7 +15,7 @@ public class TestHostExtensionManagerTests [TestInitialize] public void Initialize() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestHostExtensionManagerTests)); } [TestMethod] public void CreateShouldThrowExceptionIfMessageLoggerIsNull() diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostProviderManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostProviderManagerTests.cs index e1ba55ed39..d8e1ce85b6 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostProviderManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostProviderManagerTests.cs @@ -7,7 +7,7 @@ namespace TestPlatform.Common.UnitTests.Logging using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.Hosting; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; @@ -16,8 +16,6 @@ namespace TestPlatform.Common.UnitTests.Logging using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; using Microsoft.VisualStudio.TestTools.UnitTesting; - using TestPlatform.Common.UnitTests.ExtensionFramework; - /// /// Tests the behaviors of the TestLoggerManager class. /// @@ -26,7 +24,7 @@ public class TestHostProviderManagerTests { public TestHostProviderManagerTests() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(TestHostProviderManagerTests)); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Microsoft.TestPlatform.Common.UnitTests.csproj b/test/Microsoft.TestPlatform.Common.UnitTests/Microsoft.TestPlatform.Common.UnitTests.csproj index 47982947b0..8a796cfdc5 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Microsoft.TestPlatform.Common.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Microsoft.TestPlatform.Common.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true @@ -16,6 +17,9 @@ + + + diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/RunSettingsTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/RunSettingsTests.cs index c2b801c32e..de66fb3f65 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/RunSettingsTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/RunSettingsTests.cs @@ -7,7 +7,7 @@ namespace TestPlatform.Common.UnitTests using System.Xml; using ExtensionFramework; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestPlatform.ObjectModel; @@ -21,7 +21,7 @@ public class RunSettingsTests [TestCleanup] public void TestCleanup() { - TestPluginCacheTests.ResetExtensionsCache(); + TestPluginCacheHelper.ResetExtensionsCache(); TestSessionMessageLogger.Instance = null; } @@ -53,8 +53,8 @@ public void LoadSettingsXmlShoulLoadAndInitializeSettingsXml() // So they do not exactly match. // Assert.AreEqual(emptyRunSettings, runSettings.SettingsXml); - var expectedRunSettings = @" -"; + var expectedRunSettings = "" + Environment.NewLine + + ""; StringAssert.Contains(runSettings.SettingsXml, expectedRunSettings); } @@ -93,7 +93,7 @@ public void InitializeSettingsProvidersShouldWorkForEmptyRunSettings() [TestMethod] public void InitializeSettingsProvidersShouldThrowIfNodeInRunSettingsDoesNotHaveAProvider() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(RunSettingsTests)); var runSettings = new RunSettings(); runSettings.InitializeSettingsProviders(this.GetRunSettingsWithUndefinedSettingsNodes()); @@ -110,7 +110,7 @@ public void InitializeSettingsProvidersShouldThrowIfNodeInRunSettingsDoesNotHave [TestMethod] public void InitializeSettingsProvidersShouldThrowIfSettingsProviderLoadThrows() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(RunSettingsTests)); var runSettings = new RunSettings(); runSettings.InitializeSettingsProviders(this.GetRunSettingsWithBadSettingsNodes()); @@ -146,7 +146,7 @@ public void InitializeSettingsProvidersMultipleTimesShouldThrowInvalidOperationE [TestMethod] public void InitializeSettingsProvidersShouldLoadSettingsIntoASettingsProvider() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(RunSettingsTests)); var runSettings = new RunSettings(); runSettings.InitializeSettingsProviders(this.GetRunSettingsWithRunConfigurationNode()); @@ -165,7 +165,7 @@ public void InitializeSettingsProvidersShouldLoadSettingsIntoASettingsProvider() [TestMethod] public void InitializeSettingsProvidersShouldLoadSettingsIntoMultipleSettingsProviders() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(RunSettingsTests)); var runSettings = new RunSettings(); runSettings.InitializeSettingsProviders(this.GetRunSettingsWithRunConfigurationAndMSTestNode()); @@ -191,7 +191,7 @@ public void InitializeSettingsProvidersShouldWarnOfDuplicateSettings() { string receivedWarningMessage = null; - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(RunSettingsTests)); TestSessionMessageLogger.Instance.TestRunMessage += (object sender, TestRunMessageEventArgs e) => { receivedWarningMessage = e.Message; diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/SettingsProvider/SettingsProviderExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/SettingsProvider/SettingsProviderExtensionManagerTests.cs index bc0889c21c..8269bd5cc1 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/SettingsProvider/SettingsProviderExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/SettingsProvider/SettingsProviderExtensionManagerTests.cs @@ -7,7 +7,7 @@ namespace TestPlatform.Common.UnitTests.SettingsProvider using System.Collections.Generic; using System.Linq; using System.Xml; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities; using Microsoft.VisualStudio.TestPlatform.Common.Interfaces; using Microsoft.VisualStudio.TestPlatform.Common.SettingsProvider; @@ -80,7 +80,7 @@ public void ConstructorShouldLogWarningOnDuplicateSettingsProviderNames() [TestMethod] public void CreateShouldDiscoverSettingsProviderExtensions() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(SettingsProviderExtensionManagerTests)); var extensionManager = SettingsProviderExtensionManager.Create(); @@ -91,7 +91,7 @@ public void CreateShouldDiscoverSettingsProviderExtensions() [TestMethod] public void CreateShouldCacheDiscoveredExtensions() { - TestPluginCacheTests.SetupMockExtensions(() => { }); + TestPluginCacheHelper.SetupMockExtensions(typeof(SettingsProviderExtensionManagerTests), () => { }); var extensionManager = SettingsProviderExtensionManager.Create(); SettingsProviderExtensionManager.Create(); @@ -107,7 +107,7 @@ public void CreateShouldCacheDiscoveredExtensions() [TestMethod] public void LoadAndInitializeShouldInitializeAllExtensions() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(SettingsProviderExtensionManagerTests)); SettingsProviderExtensionManager.LoadAndInitializeAllExtensions(false); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/InstallationContextTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/InstallationContextTests.cs index 16ddace47b..b952f86484 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/InstallationContextTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/InstallationContextTests.cs @@ -8,6 +8,7 @@ namespace Microsoft.TestPlatform.Common.UnitTests.Utilities using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; + using System.Linq; [TestClass] public class InstallationContextTests @@ -46,7 +47,7 @@ public void GetVisualStudioPathShouldReturnPathToDevenvExecutable() { var devenvPath = this.installationContext.GetVisualStudioPath(@"C:\temp"); - Assert.AreEqual(@"C:\temp\devenv.exe", devenvPath); + Assert.AreEqual(@"C:\temp\devenv.exe", devenvPath.Replace("/", "\\")); } [TestMethod] @@ -60,7 +61,7 @@ public void GetVisualStudioCommonLocationShouldReturnWellKnownLocations() @"C:\temp\CommonExtensions\Microsoft\TeamFoundation\Team Explorer", @"C:\temp" }; - var commonLocations = this.installationContext.GetVisualStudioCommonLocations(@"C:\temp"); + var commonLocations = this.installationContext.GetVisualStudioCommonLocations(@"C:\temp").Select(p => p.Replace("/", "\\")).ToArray(); CollectionAssert.AreEquivalent(expectedLocations, commonLocations); } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/RunSettingsUtilitiesTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/RunSettingsUtilitiesTests.cs index 213848e345..7fa19d48f1 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/RunSettingsUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/RunSettingsUtilitiesTests.cs @@ -11,6 +11,7 @@ namespace TestPlatform.Common.UnitTests.Utilities using System.Xml; using ExtensionFramework; using System.Collections.Generic; + using Microsoft.TestPlatform.TestUtilities; [TestClass] public class RunSettingsUtilitiesTests @@ -34,11 +35,11 @@ public void CreateRunSettingsShouldThrowExceptionWhenInvalidXmlStringIsPassed() [TestMethod] public void CreateRunSettingsShouldReturnValidRunSettings() { - TestPluginCacheTests.SetupMockExtensions(); + TestPluginCacheHelper.SetupMockExtensions(typeof(RunSettingsUtilitiesTests)); string runsettings = @".\TestResultstrue"; var result= RunSettingsUtilities.CreateAndInitializeRunSettings(runsettings); Assert.AreEqual("true", DummyMsTestSetingsProvider.StringToVerify); - TestPluginCacheTests.ResetExtensionsCache(); + TestPluginCacheHelper.ResetExtensionsCache(); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests.csproj b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests.csproj index e49290e819..8943f5e5b7 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests.csproj +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestHandlerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestHandlerTests.cs index e34b9a18ca..08779a496b 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestHandlerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestHandlerTests.cs @@ -18,6 +18,7 @@ namespace Microsoft.TestPlatform.CommunicationUtilities.UnitTests using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Serialization; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; @@ -235,7 +236,8 @@ public void ProcessRequestsShouldAddSourceDirectoryToTestPluginCache() var testHostLaunchedPayload = new TestHostLaunchedPayload(); testHostLaunchedPayload.ProcessId = 1234; - string runSettings = "d:\\users;f:\\users"; + var temp = Path.GetTempPath(); + string runSettings = ""; this.mockCommunicationManager.SetupSequence(x => x.ReceiveMessage()).Returns(this.beforeTestRunStart) .Returns(new Message() { MessageType = MessageType.TestHostLaunched, Payload = JToken.FromObject(testHostLaunchedPayload) }) @@ -245,16 +247,25 @@ public void ProcessRequestsShouldAddSourceDirectoryToTestPluginCache() this.mockDataCollectionManager.Setup(x => x.TestHostLaunched(It.IsAny())); this.mockDataSerializer.Setup(x => x.DeserializePayload(It.Is(y => y.MessageType == MessageType.TestHostLaunched))) .Returns(testHostLaunchedPayload); - var beforeTestRunSTartPayload = new BeforeTestRunStartPayload { SettingsXml = runSettings, Sources = new List { @"E:\dir1\test1.dll", @"E:\dir2\test2.dll", @"E:\dir1\test2.dll" } }; + var beforeTestRunSTartPayload = new BeforeTestRunStartPayload + { + SettingsXml = runSettings, + Sources = new List + { + Path.Combine(temp, "dir1", "test1.dll"), + Path.Combine(temp, "dir2", "test2.dll"), + Path.Combine(temp, "dir3", "test3.dll") + } + }; this.mockDataSerializer.Setup(x => x.DeserializePayload(It.Is(y => y.MessageType == MessageType.BeforeTestRunStart))) .Returns(beforeTestRunSTartPayload); - this.mockFileHelper.Setup(x => x.DirectoryExists(@"E:\dir1")).Returns(true); - this.mockFileHelper.Setup(x => x.EnumerateFiles("E:\\dir1", SearchOption.AllDirectories, @"Collector.dll")).Returns(new List { @"E:\dir1\abc.datacollector.dll" }); + this.mockFileHelper.Setup(x => x.DirectoryExists($@"{temp}dir1")).Returns(true); + this.mockFileHelper.Setup(x => x.EnumerateFiles($@"{temp}dir1", SearchOption.AllDirectories, @"Collector.dll")).Returns(new List { Path.Combine(temp, "dir1", "abc.DataCollector.dll") }); this.requestHandler.ProcessRequests(); - this.mockFileHelper.Verify(x => x.EnumerateFiles("E:\\dir1", SearchOption.AllDirectories, @"Collector.dll"), Times.Once); - Assert.IsTrue(TestPluginCache.Instance.GetExtensionPaths(@"Collector.dll").Contains(@"E:\dir1\abc.datacollector.dll")); + this.mockFileHelper.Verify(x => x.EnumerateFiles($@"{temp}dir1", SearchOption.AllDirectories, @"Collector.dll"), Times.Once); + Assert.IsTrue(TestPluginCache.Instance.GetExtensionPaths(@"Collector.dll").Contains(Path.Combine(temp, "dir1", "abc.DataCollector.dll"))); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.UnitTests.csproj b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.UnitTests.csproj index 7c709cb69c..43edb6f320 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Microsoft.TestPlatform.CoreUtilities.UnitTests.csproj b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Microsoft.TestPlatform.CoreUtilities.UnitTests.csproj index b9e7d91662..49ccfde044 100644 --- a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Microsoft.TestPlatform.CoreUtilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Microsoft.TestPlatform.CoreUtilities.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyDiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyDiscoveryManagerTests.cs index d0c03775ab..667147dd02 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyDiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyDiscoveryManagerTests.cs @@ -4,6 +4,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Client { using System; + using System.IO; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -64,9 +65,10 @@ public void DiscoverTestsShouldUpdateTestPluginCacheWithExtensionsReturnByTestHo this.mockDiscoveryManager.Setup(o => o.Initialize(Enumerable.Empty(), null)).Callback( () => manualResetEvent.Set()); - this.mockTestHostManager.Setup(o => o.GetTestPlatformExtensions(It.IsAny>(), It.IsAny>())).Returns(new List { "C:\\DiscoveryDummy.dll" }); + var path = Path.Combine(Path.GetTempPath(), "DiscoveryDummy.dll"); + this.mockTestHostManager.Setup(o => o.GetTestPlatformExtensions(It.IsAny>(), It.IsAny>())).Returns(new List { path }); var expectedResult = TestPluginCache.Instance.GetExtensionPaths(string.Empty); - expectedResult.Add("C:\\DiscoveryDummy.dll"); + expectedResult.Add(path); var discoveryCriteria = new DiscoveryCriteria(new[] { "test.dll" }, 1, string.Empty); this.inProcessProxyDiscoveryManager.DiscoverTests(discoveryCriteria, null); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs index 0003712027..f4f2ad00ff 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs @@ -4,6 +4,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Client { using System; + using System.IO; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -57,9 +58,10 @@ public void StartTestRunShouldCallInitialize() [TestMethod] public void StartTestRunShouldUpdateTestPlauginCacheWithExtensionsReturnByTestHost() { - this.mockTestHostManager.Setup(o => o.GetTestPlatformExtensions(It.IsAny>(), It.IsAny>())).Returns(new List { "C:\\dummy.dll" }); + var path = Path.Combine(Path.GetTempPath(), "dummy.dll"); + this.mockTestHostManager.Setup(o => o.GetTestPlatformExtensions(It.IsAny>(), It.IsAny>())).Returns(new List { path }); var expectedResult = TestPluginCache.Instance.GetExtensionPaths(string.Empty); - expectedResult.Add("C:\\dummy.dll"); + expectedResult.Add(path); var testRunCriteria = new TestRunCriteria(new List { "source.dll" }, 10); this.inProcessProxyExecutionManager.StartTestRun(testRunCriteria, null); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs index c8a79638c2..79d9a8f80f 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs @@ -9,7 +9,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Client using System.Linq; using System.Threading; using System.Threading.Tasks; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; @@ -23,7 +23,6 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Client using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; - using TestPlatform.Common.UnitTests.ExtensionFramework; [TestClass] public class ProxyDiscoveryManagerTests : ProxyBaseManagerTests @@ -183,7 +182,7 @@ public void DiscoverTestsShouldInitializeExtensionsIfPresent() var extensions = new[] { "c:\\e1.dll", "c:\\e2.dll" }; // Setup Mocks. - TestPluginCacheTests.SetupMockAdditionalPathExtensions(extensions); + TestPluginCacheHelper.SetupMockAdditionalPathExtensions(extensions); this.mockFileHelper.Setup(fh => fh.Exists(It.IsAny())).Returns(true); this.mockRequestSender.Setup(s => s.WaitForRequestHandlerConnection(It.IsAny(), It.IsAny())).Returns(true); this.mockTestHostManager.Setup(th => th.GetTestPlatformExtensions(It.IsAny>(), It.IsAny>())).Returns(new[] { "c:\\e1.dll", "c:\\e2.dll" }); @@ -205,7 +204,7 @@ public void DiscoverTestsShouldInitializeExtensionsWithExistingExtensionsOnly() var inputExtensions = new[] { "abc.TestAdapter.dll", "def.TestAdapter.dll", "xyz.TestAdapter.dll" }; var expectedOutputPaths = new[] { "abc.TestAdapter.dll", "xyz.TestAdapter.dll" }; - TestPluginCacheTests.SetupMockAdditionalPathExtensions(inputExtensions); + TestPluginCacheHelper.SetupMockAdditionalPathExtensions(inputExtensions); this.mockRequestSender.Setup(s => s.WaitForRequestHandlerConnection(It.IsAny(), It.IsAny())).Returns(true); this.mockTestHostManager.Setup(th => th.GetTestPlatformExtensions(It.IsAny>(), It.IsAny>())).Returns((IEnumerable sources, IEnumerable extensions) => { @@ -232,7 +231,7 @@ public void DiscoverTestsShouldQueryTestHostManagerForExtensions() TestPluginCache.Instance = null; try { - TestPluginCacheTests.SetupMockAdditionalPathExtensions(new[] { "c:\\e1.dll" }); + TestPluginCacheHelper.SetupMockAdditionalPathExtensions(new[] { "c:\\e1.dll" }); this.mockFileHelper.Setup(fh => fh.Exists(It.IsAny())).Returns(true); this.mockRequestSender.Setup(s => s.WaitForRequestHandlerConnection(It.IsAny(), It.IsAny())).Returns(true); this.mockTestHostManager.Setup(th => th.GetTestPlatformExtensions(It.IsAny>(), It.IsAny>())).Returns(new[] { "he1.dll", "c:\\e1.dll" }); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs index c0fa9095a5..d919f10906 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs @@ -4,6 +4,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.DataCollection { using System; + using System.IO; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -38,7 +39,8 @@ public class InProcDataCollectionExtensionManagerTests "; private Mock mockTestEventsPublisher; private TestableInProcDataCollectionExtensionManager inProcDataCollectionManager; - private string defaultCodebase = "E:\\repos\\MSTest\\src\\managed\\TestPlatform\\TestImpactListener.Tests\\bin\\Debug"; + private static string temp = Path.GetTempPath(); + private string defaultCodebase = Path.Combine(temp, "repos", "MSTest", "src", "managed", "TestPlatform", "TestImpactListener.Tests", "bin", "Debug"); private Mock mockFileHelper; private TestPluginCache testPluginCache; @@ -59,9 +61,9 @@ public void InProcDataCollectionExtensionManagerShouldLoadsDataCollectorsFromRun Assert.IsTrue(inProcDataCollectionManager.IsInProcDataCollectionEnabled, "InProcDataCollection must be enabled if runsettings contains inproc datacollectors."); Assert.AreEqual(1, inProcDataCollectionManager.InProcDataCollectors.Count, "One Datacollector must be registered"); - Assert.IsTrue(string.Equals(dataCollector.AssemblyQualifiedName, "TestImpactListener.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ccb7239ffde675a", StringComparison.OrdinalIgnoreCase)); - Assert.IsTrue(string.Equals(dataCollector.CodeBase, @"E:\repos\MSTest\src\managed\TestPlatform\TestImpactListener.Tests\bin\Debug\TestImpactListener.Tests.dll", StringComparison.OrdinalIgnoreCase)); - Assert.IsTrue(string.Equals(dataCollector.Configuration.OuterXml.ToString(), @"4312", StringComparison.OrdinalIgnoreCase)); + StringAssert.Equals(dataCollector.AssemblyQualifiedName, "TestImpactListener.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ccb7239ffde675a"); + StringAssert.Equals(dataCollector.CodeBase, Path.Combine(temp, "repos", "MSTest", "src", "managed", "TestPlatform", "TestImpactListener.Tests", "bin", "Debug", "TestImpactListener.Tests.dll")); + StringAssert.Equals(dataCollector.Configuration.OuterXml.ToString(), @"4312"); } [TestMethod] @@ -79,11 +81,11 @@ public void InProcDataCollectionExtensionManagerLoadsDataCollectorFromDefaultCod "; - this.mockFileHelper.Setup(fh => fh.Exists(@"E:\repos\MSTest\src\managed\TestPlatform\TestImpactListener.Tests\bin\Debug\TestImpactListener.Tests.dll")).Returns(true); + this.mockFileHelper.Setup(fh => fh.Exists(Path.Combine(temp, "repos", "MSTest", "src", "managed", "TestPlatform", "TestImpactListener.Tests", "bin", "Debug", "TestImpactListener.Tests.dll"))).Returns(true); this.inProcDataCollectionManager = new TestableInProcDataCollectionExtensionManager(settingsXml, this.mockTestEventsPublisher.Object, this.defaultCodebase, this.testPluginCache, this.mockFileHelper.Object); var codebase = (inProcDataCollectionManager.InProcDataCollectors.Values.First() as MockDataCollector).CodeBase; - Assert.AreEqual(@"E:\repos\MSTest\src\managed\TestPlatform\TestImpactListener.Tests\bin\Debug\TestImpactListener.Tests.dll", codebase); + Assert.AreEqual(Path.Combine(temp, "repos", "MSTest", "src", "managed", "TestPlatform", "TestImpactListener.Tests", "bin", "Debug", "TestImpactListener.Tests.dll"), codebase); } [TestMethod] @@ -101,13 +103,13 @@ public void InProcDataCollectionExtensionManagerLoadsDataCollectorFromTestPlugin "; - this.testPluginCache.UpdateExtensions(new List { @"E:\source\.nuget\TestImpactListenerDataCollector.dll" }, true); - this.mockFileHelper.Setup(fh => fh.Exists(@"E:\source\.nuget\TestImpactListenerDataCollector.dll")).Returns(true); + this.testPluginCache.UpdateExtensions(new List { Path.Combine(temp, "source", ".nuget", "TestImpactListenerDataCollector.dll") }, true); + this.mockFileHelper.Setup(fh => fh.Exists(Path.Combine(temp, "source", ".nuget", "TestImpactListenerDataCollector.dll"))).Returns(true); this.inProcDataCollectionManager = new TestableInProcDataCollectionExtensionManager(settingsXml, this.mockTestEventsPublisher.Object, this.defaultCodebase, this.testPluginCache, this.mockFileHelper.Object); var codebase = (inProcDataCollectionManager.InProcDataCollectors.Values.First() as MockDataCollector).CodeBase; - Assert.AreEqual(@"E:\source\.nuget\TestImpactListenerDataCollector.dll", codebase); + Assert.AreEqual(Path.Combine(temp,"source", ".nuget", "TestImpactListenerDataCollector.dll"), codebase); } [TestMethod] @@ -133,15 +135,18 @@ public void InProcDataCollectionExtensionManagerLoadsDataCollectorFromGivenCodeb [TestMethod] public void InProcDataCollectorIsReadingMultipleDataCollector() { - var multiSettingsXml = @" + var temp = Path.GetTempPath(); + var path1 = Path.Combine(temp, "repos", "MSTest", "src", "managed", "TestPlatform", "TestImpactListener.Tests", "bin", "Debug", "TestImpactListener.Tests1.dll"); + var path2 = Path.Combine(temp, "repos", "MSTest", "src", "managed", "TestPlatform", "TestImpactListener.Tests", "bin", "Debug", "TestImpactListener.Tests2.dll"); + var multiSettingsXml = $@" - + 4312 - + 4313 @@ -169,11 +174,11 @@ public void InProcDataCollectorIsReadingMultipleDataCollector() } Assert.IsTrue(string.Equals(dataCollector1.AssemblyQualifiedName, "TestImpactListener.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ccb7239ffde675a", StringComparison.OrdinalIgnoreCase)); - Assert.IsTrue(string.Equals(dataCollector1.CodeBase, @"E:\repos\MSTest\src\managed\TestPlatform\TestImpactListener.Tests\bin\Debug\TestImpactListener.Tests1.dll", StringComparison.OrdinalIgnoreCase)); + Assert.IsTrue(string.Equals(dataCollector1.CodeBase, Path.Combine(temp, "repos", "MSTest", "src", "managed", "TestPlatform", "TestImpactListener.Tests", "bin", "Debug", "TestImpactListener.Tests1.dll"), StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(string.Equals(dataCollector1.Configuration.OuterXml.ToString(), @"4312", StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(string.Equals(dataCollector2.AssemblyQualifiedName, "TestImpactListener.Tests, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7ccb7239ffde675a", StringComparison.OrdinalIgnoreCase)); - Assert.IsTrue(string.Equals(dataCollector2.CodeBase, @"E:\repos\MSTest\src\managed\TestPlatform\TestImpactListener.Tests\bin\Debug\TestImpactListener.Tests2.dll", StringComparison.OrdinalIgnoreCase)); + Assert.IsTrue(string.Equals(dataCollector2.CodeBase, Path.Combine(temp, "repos", "MSTest", "src", "managed", "TestPlatform", "TestImpactListener.Tests", "bin", "Debug", "TestImpactListener.Tests2.dll"), StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(string.Equals(dataCollector2.Configuration.OuterXml.ToString(), @"4313", StringComparison.OrdinalIgnoreCase)); } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs index 55ddd24293..2f34e29ae0 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs @@ -6,6 +6,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.DataCollection using System.IO; using System.Reflection; using Coverlet.Collector.DataCollection; + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces; @@ -16,7 +17,6 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.DataCollection using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; - using TestPlatform.Common.UnitTests.ExtensionFramework; [TestClass] public class InProcDataCollectorTests diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs index fc6aed366e..16f4749e9b 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs @@ -10,6 +10,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Discovery using System.Linq; using System.Reflection; using System.Threading; + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.Interfaces; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; @@ -24,8 +25,6 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Discovery using Moq; - using TestPlatform.Common.UnitTests.ExtensionFramework; - [TestClass] public class DiscovererEnumeratorTests { @@ -50,7 +49,7 @@ public DiscovererEnumeratorTests() this.discovererEnumerator = new DiscovererEnumerator(this.mockRequestData.Object, this.discoveryResultCache, this.mockTestPlatformEventSource.Object, this.mockAssemblyProperties.Object, this.cancellationTokenSource.Token); this.runSettingsMock = new Mock(); this.messageLoggerMock = new Mock(); - TestPluginCacheTests.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); TestDiscoveryExtensionManager.Destroy(); } @@ -67,7 +66,7 @@ public void Cleanup() [TestMethod] public void LoadTestsShouldReportWarningOnNoDiscoverers() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(TestPluginCache).GetTypeInfo().Assembly.Location }, () => { }); var sources = new List { typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location }; @@ -89,7 +88,7 @@ public void LoadTestsShouldReportWarningOnNoDiscoverers() [TestMethod] public void LoadTestsShouldNotCallIntoDiscoverersIfNoneMatchesSources() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); var sources = new List { "temp.jpeg" }; @@ -106,7 +105,7 @@ public void LoadTestsShouldNotCallIntoDiscoverersIfNoneMatchesSources() [TestMethod] public void LoadTestsShouldCallOnlyNativeDiscovererIfNativeAssembliesPassed() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -134,7 +133,7 @@ public void LoadTestsShouldCallOnlyNativeDiscovererIfNativeAssembliesPassed() [TestMethod] public void LoadTestsShouldCallOnlyManagedDiscovererIfManagedAssembliesPassed() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -162,7 +161,7 @@ public void LoadTestsShouldCallOnlyManagedDiscovererIfManagedAssembliesPassed() [TestMethod] public void LoadTestsShouldCallBothNativeAndManagedDiscoverersWithCorrectSources() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -197,7 +196,7 @@ public void LoadTestsShouldCallBothNativeAndManagedDiscoverersWithCorrectSources [TestMethod] public void LoadTestsShouldCallIntoADiscovererThatMatchesTheSources() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -227,7 +226,7 @@ public void LoadTestsShouldCallIntoADiscovererThatMatchesTheSources() [TestMethod] public void LoadTestsShouldCallIntoMultipleDiscoverersThatMatchesTheSources() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -273,7 +272,7 @@ public void LoadTestsShouldCallIntoMultipleDiscoverersThatMatchesTheSources() [TestMethod] public void LoadTestsShouldCallIntoOtherDiscoverersWhenCreatingOneFails() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -306,7 +305,7 @@ public void LoadTestsShouldCallIntoOtherDiscoverersWhenCreatingOneFails() [TestMethod] public void LoadTestsShouldCallIntoOtherDiscoverersEvenIfDiscoveryInOneFails() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -352,7 +351,7 @@ public void LoadTestsShouldCollectMetrics() var dict = new Dictionary(); dict.Add("DummyMessage", "DummyValue"); - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -387,7 +386,7 @@ public void LoadTestsShouldNotCallIntoDiscoverersWhenCancelled() { // Setup string[] extensions = new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }; - TestPluginCacheTests.SetupMockExtensions(extensions, () => { }); + TestPluginCacheHelper.SetupMockExtensions(extensions, () => { }); var dllsources = new List { @@ -469,7 +468,7 @@ public void LoadTestShouldInstrumentAdapterDiscoveryStop() [TestMethod] public void LoadTestsShouldIterateOverAllExtensionsInTheMapAndDiscoverTests() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -573,7 +572,7 @@ private static void SetupForNoTestsAvailableInGivenAssemblies( private void InvokeLoadTestWithMockSetup() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs index 44b402f182..e1d3c54c3e 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs @@ -8,7 +8,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Discovery using System.IO; using System.Linq; using System.Reflection; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; @@ -21,8 +21,6 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Discovery using Moq; - using TestPlatform.Common.UnitTests.ExtensionFramework; - using CrossPlatEngineResources = Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources; [TestClass] @@ -61,7 +59,7 @@ public void InitializeShouldUpdateAdditionalExtenions() TestPluginCache.Instance = new TestableTestPluginCache(); this.discoveryManager.Initialize( - new string[] { typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location }, mockLogger.Object); + new string[] { typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location }, mockLogger.Object); var allDiscoverers = TestDiscoveryExtensionManager.Create().Discoverers; @@ -112,7 +110,7 @@ public void DiscoverTestsShouldLogIfThereAreNoValidSources() [TestMethod] public void DiscoverTestsShouldLogIfTheSameSourceIsSpecifiedTwice() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -139,7 +137,7 @@ public void DiscoverTestsShouldLogIfTheSameSourceIsSpecifiedTwice() [TestMethod] public void DiscoverTestsShouldDiscoverTestsInTheSpecifiedSource() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -167,7 +165,7 @@ public void DiscoverTestsShouldSendMetricsOnDiscoveryComplete() DiscoveryCompleteEventArgs receivedDiscoveryCompleteEventArgs = null; - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -206,7 +204,7 @@ public void DiscoverTestsShouldCollectMetrics() mockMetricsCollector.Setup(mc => mc.Metrics).Returns(dict); this.mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollector.Object); - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -231,7 +229,7 @@ public void DiscoveryInitializeShouldVerifyWarningMessageIfAdapterFailedToLoad() { var assemblyLocation = typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location; var mockLogger = new Mock(); - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { assemblyLocation }, () => { }); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs index a3af85cdf4..a85aec8b51 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs @@ -85,6 +85,7 @@ public void InitializeCommunicationShouldConnectToServerAsynchronously() } [TestMethod] + [TestCategory("Windows")] public void InitializeCommunicationShouldThrowIfServerIsNotAccessible() { var connectionInfo = new TestHostConnectionInfo diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs index 45bce131bd..1bc31d8cef 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs @@ -9,8 +9,6 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Execution using System.Linq; using System.Reflection; - using Common.UnitTests.ExtensionFramework; - using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities; using Microsoft.VisualStudio.TestPlatform.Common.Interfaces; @@ -34,6 +32,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Execution using Moq; + using Microsoft.TestPlatform.TestUtilities; [TestClass] public class BaseRunTestsTests @@ -96,14 +95,14 @@ public BaseRunTestsTests() new PlatformThread(), this.mockDataSerializer.Object); - TestPluginCacheTests.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location }, () => { }); + TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location }, () => { }); } [TestCleanup] public void Cleanup() { TestExecutorExtensionManager.Destroy(); - TestPluginCacheTests.ResetExtensionsCache(); + TestPluginCacheHelper.ResetExtensionsCache(); } #region Constructor tests @@ -849,7 +848,7 @@ private void SetupForExecutionThreadApartmentStateTests(PlatformApartmentState a this.mockThread.Object, this.mockDataSerializer.Object); - TestPluginCacheTests.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location }, () => { }); + TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location }, () => { }); var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; var executorUriExtensionMap = new List> { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs index 596f2676b8..ce5d24ea30 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs @@ -6,8 +6,10 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Execution using System; using System.Collections.Generic; using System.Reflection; + using System.Xml; + + using Microsoft.TestPlatform.TestUtilities; - using Common.UnitTests.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities; @@ -20,12 +22,12 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Execution using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; + using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; - using TestPlatform.Common.UnitTests.Utilities; - using static RunTestsWithSourcesTests; [TestClass] @@ -74,11 +76,11 @@ public void TestCleanup() } [TestMethod] - public void InitializeShouldLoadAndInitializeAllExtension() + public void InitializeShouldLoadAndInitializeAllExtensions() { - var commonAssemblyLocation = typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location; + var commonAssemblyLocation = typeof(ExecutionManagerTests).GetTypeInfo().Assembly.Location; var mockTestMessageEventHandler = new Mock(); - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { commonAssemblyLocation }, () => { }); @@ -110,7 +112,7 @@ public void InitializeShouldLoadAndInitializeAllExtension() public void StartTestRunShouldRunTestsInTheProvidedSources() { var assemblyLocation = typeof(ExecutionManagerTests).GetTypeInfo().Assembly.Location; - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { assemblyLocation }, () => { }); TestPluginCache.Instance.DiscoverTestExtensions(TestPlatformConstants.TestAdapterEndsWithPattern); @@ -172,7 +174,7 @@ public void StartTestRunShouldRunTestsForTheProvidedTests() "A.dll")); fh.RecordResult(tr); }; - TestPluginCacheTests.SetupMockExtensions(new string[] { assemblyLocation }, () => { }); + TestPluginCacheHelper.SetupMockExtensions(new string[] { assemblyLocation }, () => { }); this.executionManager.StartTestRun(tests, null, null, testExecutionContext, null, mockTestRunEventsHandler.Object); @@ -219,7 +221,7 @@ public void StartTestRunShouldAbortTheRunIfAnyExceptionComesForTheProvidedSource //{ // var assemblyLocation = typeof(ExecutionManagerTests).GetTypeInfo().Assembly.Location; // var mockLogger = new Mock(); - // TestPluginCacheTests.SetupMockExtensions( + // TestPluginCacheHelper.SetupMockExtensions( // new string[] { assemblyLocation }, // () => { }); // //Act @@ -243,5 +245,211 @@ public void InitializeShouldVerifyTheHandlerInitializationWhenAdapterIsFailedToL // Verify. mockLogger.Verify(rd => rd.HandleLogMessage(It.IsAny(), "verify that the HandleLogMessage method will not be invoked when handler is not initialized"), Times.Never); } + + #region Implementations + + #region Discoverers + + private abstract class AbstractTestDiscoverer : ITestDiscoverer + { + public void DiscoverTests(IEnumerable sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink) + { + throw new NotImplementedException(); + } + } + + private class ValidDiscoverer : ITestDiscoverer + { + public void DiscoverTests(IEnumerable sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink) + { + throw new NotImplementedException(); + } + } + + private class ValidDiscoverer2 : ITestDiscoverer + { + public void DiscoverTests(IEnumerable sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink) + { + throw new NotImplementedException(); + } + } + + #endregion + + #region Executors + + [ExtensionUri("ValidExecutor")] + private class ValidExecutor : ITestExecutor + { + public void Cancel() + { + throw new NotImplementedException(); + } + + public void RunTests(IEnumerable sources, IRunContext runContext, IFrameworkHandle frameworkHandle) + { + throw new NotImplementedException(); + } + + public void RunTests(IEnumerable tests, IRunContext runContext, IFrameworkHandle frameworkHandle) + { + throw new NotImplementedException(); + } + } + + [ExtensionUri("ValidExecutor2")] + private class ValidExecutor2 : ITestExecutor + { + public void Cancel() + { + throw new NotImplementedException(); + } + + public void RunTests(IEnumerable sources, IRunContext runContext, IFrameworkHandle frameworkHandle) + { + throw new NotImplementedException(); + } + + public void RunTests(IEnumerable tests, IRunContext runContext, IFrameworkHandle frameworkHandle) + { + throw new NotImplementedException(); + } + } + + [ExtensionUri("ValidExecutor")] + private class DuplicateExecutor : ITestExecutor + { + public void Cancel() + { + throw new NotImplementedException(); + } + + public void RunTests(IEnumerable sources, IRunContext runContext, IFrameworkHandle frameworkHandle) + { + throw new NotImplementedException(); + } + + public void RunTests(IEnumerable tests, IRunContext runContext, IFrameworkHandle frameworkHandle) + { + throw new NotImplementedException(); + } + } + + #endregion + + #region Loggers + + [ExtensionUri("csv")] + private class ValidLogger : ITestLogger + { + public void Initialize(TestLoggerEvents events, string testRunDirectory) + { + throw new NotImplementedException(); + } + } + + [ExtensionUri("docx")] + private class ValidLogger2 : ITestLogger + { + public void Initialize(TestLoggerEvents events, string testRunDirectory) + { + throw new NotImplementedException(); + } + } + + [ExtensionUri("csv")] + private class DuplicateLogger : ITestLogger + { + public void Initialize(TestLoggerEvents events, string testRunDirectory) + { + throw new NotImplementedException(); + } + } + + #endregion + + #region Settings Providers + + [SettingsName("ValidSettingsProvider")] + private class ValidSettingsProvider : ISettingsProvider + { + public void Load(XmlReader reader) + { + throw new NotImplementedException(); + } + } + + [SettingsName("ValidSettingsProvider2")] + private class ValidSettingsProvider2 : ISettingsProvider + { + public void Load(XmlReader reader) + { + throw new NotImplementedException(); + } + } + + [SettingsName("ValidSettingsProvider")] + private class DuplicateSettingsProvider : ISettingsProvider + { + public void Load(XmlReader reader) + { + throw new NotImplementedException(); + } + } + + #endregion + + #region DataCollectors + + public class InvalidDataCollector : DataCollector + { + public override void Initialize( + XmlElement configurationElement, + DataCollectionEvents events, + DataCollectionSink dataSink, + DataCollectionLogger logger, + DataCollectionEnvironmentContext environmentContext) + { + + } + } + + /// + /// The a data collector inheriting from another data collector. + /// + [DataCollectorFriendlyName("Foo1")] + [DataCollectorTypeUri("datacollector://foo/bar1")] + public class ADataCollectorInheritingFromAnotherDataCollector : InvalidDataCollector + { + } + + [DataCollectorFriendlyName("Foo")] + [DataCollectorTypeUri("datacollector://foo/bar")] + public class ValidDataCollector : DataCollector + { + public override void Initialize( + XmlElement configurationElement, + DataCollectionEvents events, + DataCollectionSink dataSink, + DataCollectionLogger logger, + DataCollectionEnvironmentContext environmentContext) + { + + } + } + #endregion + + internal class FaultyTestExecutorPluginInformation : TestExtensionPluginInformation + { + /// + /// Default constructor + /// + /// The Type. + public FaultyTestExecutorPluginInformation(Type type) : base(type) + { + throw new Exception(); + } + } + #endregion } } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs index 40d551968d..b8754f6582 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs @@ -7,7 +7,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Execution using System.Collections.Generic; using System.Linq; using System.Reflection; - + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities; @@ -26,8 +26,6 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Execution using TestableImplementations; - using TestPlatform.Common.UnitTests.ExtensionFramework; - [TestClass] public class RunTestsWithSourcesTests { @@ -60,7 +58,7 @@ public void TestInit() this.mockRequestData = new Mock(); this.mockRequestData.Setup(rd => rd.MetricsCollection).Returns(this.mockMetricsCollection.Object); - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(RunTestsWithSourcesTests).GetTypeInfo().Assembly.Location }, () => { }); @@ -72,7 +70,7 @@ public void TestInit() public void TestCleanup() { RunTestWithSourcesExecutor.RunTestsWithSourcesCallback = null; - TestPluginCacheTests.ResetExtensionsCache(); + TestPluginCacheHelper.ResetExtensionsCache(); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj index 93b7a906e1..7f159a7f5c 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true @@ -15,10 +16,10 @@ - true + diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs index 410c000ef9..47f374dc5f 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs @@ -9,6 +9,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests using System.Reflection; using Microsoft.TestPlatform.CrossPlatEngine.UnitTests.TestableImplementations; + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.Parallel; @@ -21,8 +22,6 @@ namespace TestPlatform.CrossPlatEngine.UnitTests using Moq; - using TestPlatform.Common.UnitTests.ExtensionFramework; - [TestClass] public class TestEngineTests { @@ -35,7 +34,7 @@ public class TestEngineTests public TestEngineTests() { - TestPluginCacheTests.SetupMockExtensions(new[] { typeof(TestEngineTests).GetTypeInfo().Assembly.Location }, () => { }); + TestPluginCacheHelper.SetupMockExtensions(new[] { typeof(TestEngineTests).GetTypeInfo().Assembly.Location }, () => { }); this.mockProcessHelper = new Mock(); this.testableTestRuntimeProvider = new TestableRuntimeProvider(true); this.mockRequestData = new Mock(); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs index 949de7bb5c..9221db7145 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs @@ -9,7 +9,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests using System.Collections.Generic; using System.Reflection; using System.Threading; - using global::TestPlatform.Common.UnitTests.ExtensionFramework; + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; @@ -35,7 +35,7 @@ public class TestLoggerManagerTests [TestInitialize] public void Initialize() { - TestPluginCacheTests.SetupMockExtensions( + TestPluginCacheHelper.SetupMockExtensions( new string[] { typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location }, () => { }); } @@ -43,7 +43,7 @@ public void Initialize() [TestCleanup] public void TestCleanup() { - TestPluginCacheTests.ResetExtensionsCache(); + TestPluginCacheHelper.ResetExtensionsCache(); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Utilities/TestSourcesUtilityTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Utilities/TestSourcesUtilityTests.cs index eddd4de701..5eaf9d64de 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Utilities/TestSourcesUtilityTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Utilities/TestSourcesUtilityTests.cs @@ -4,6 +4,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Adapter { using System; + using System.IO; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Utilities; @@ -13,6 +14,8 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Adapter [TestClass] public class TestSourcesUtilityTests { + private static string temp = Path.GetTempPath(); + [TestMethod] public void GetSourcesShouldAggregateSourcesIfMultiplePresentInAdapterSourceMap() { @@ -31,9 +34,10 @@ public void GetSourcesShouldAggregateSourcesIfMultiplePresentInAdapterSourceMap( [TestMethod] public void GetSourcesShouldGetDistinctSourcesFromTestCases() { - var tests = new List() { new TestCase("test1", new Uri("e://d"), "source1.dll"), - new TestCase("test2", new Uri("e://d"), "source2.dll"), - new TestCase("test3", new Uri("e://d"), "source1.dll")}; + var path = Path.Combine(temp, "d"); + var tests = new List() { new TestCase("test1", new Uri(path), "source1.dll"), + new TestCase("test2", new Uri(path), "source2.dll"), + new TestCase("test3", new Uri(path), "source1.dll")}; var sources = TestSourcesUtility.GetSources(tests); Assert.AreEqual(2, sources.Count()); @@ -63,19 +67,19 @@ public void GetDefaultCodeBasePathShouldReturnNullIfTestCaseListIsEmpty() public void GetDefaultCodeBasePathShouldReturnDefaultDirectoryPathForAdapterSourceMap() { var adapterSourceMap = new Dictionary>(); - adapterSourceMap.Add("adapter1", new List() { "c:\\folder1\\source1.dll", "c:\\folder2\\source2.dll" }); + adapterSourceMap.Add("adapter1", new List() { Path.Combine(temp, "folder1", "source1.dll"), Path.Combine(temp, "folder2", "source2.dll") }); var defaultCodeBase = TestSourcesUtility.GetDefaultCodebasePath(adapterSourceMap); - Assert.AreEqual("c:\\folder1", defaultCodeBase); + Assert.AreEqual(Path.Combine(temp, "folder1"), defaultCodeBase); } [TestMethod] public void GetDefaultCodeBasePathShouldReturnDefaultDirectoryPathForTestCaseList() { - var tests = new List() { new TestCase("test1", new Uri("e://d"), "c:\\folder1\\source1.dll") }; + var tests = new List() { new TestCase("test1", new Uri(Path.Combine(temp, "d")), Path.Combine(temp, "folder1", "source1.dll")) }; var defaultCodeBase = TestSourcesUtility.GetDefaultCodebasePath(tests); - Assert.AreEqual("c:\\folder1", defaultCodeBase); + Assert.AreEqual(Path.Combine(temp, "folder1"), defaultCodeBase); } } } diff --git a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs index 7a036fdda3..2886b13aa3 100644 --- a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs @@ -22,6 +22,7 @@ namespace Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests /// The blame collector tests. /// [TestClass] + [TestCategory("Windows")] public class BlameCollectorTests { private DataCollectionEnvironmentContext context; diff --git a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests.csproj b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests.csproj index b472cd5412..3ea0be736f 100644 --- a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj index 9b61960acb..e759df800e 100644 --- a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true true true diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests.csproj b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests.csproj index b3ff286ad3..ea6f73b955 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true true true diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs index 0c5dd9789a..6311ba1715 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs @@ -72,8 +72,9 @@ public void ToCollectionEntriesShouldRenameAttachmentUriIfTheAttachmentNameIsSam this.converter = new Converter(new FileHelper(), trxFileHelper); List collectorDataEntries = this.converter.ToCollectionEntries(attachmentSets, testRun, testResultsDirectory); - Assert.AreEqual($@"{Environment.MachineName}\123.coverage", ((ObjectModel.UriDataAttachment) collectorDataEntries[0].Attachments[0]).Uri.OriginalString); - Assert.AreEqual($@"{Environment.MachineName}\123[1].coverage", ((ObjectModel.UriDataAttachment)collectorDataEntries[0].Attachments[1]).Uri.OriginalString); + Assert.AreEqual(2, collectorDataEntries[0].Attachments.Count); + Assert.AreEqual($@"{Environment.MachineName}{Path.DirectorySeparatorChar}123.coverage", ((ObjectModel.UriDataAttachment) collectorDataEntries[0].Attachments[0]).Uri.OriginalString); + Assert.AreEqual($@"{Environment.MachineName}{Path.DirectorySeparatorChar}123[1].coverage", ((ObjectModel.UriDataAttachment)collectorDataEntries[0].Attachments[1]).Uri.OriginalString); Directory.Delete(tempDir, true); } @@ -207,9 +208,9 @@ private static void SetupForToCollectionEntries(out string tempDir, out List { new AttachmentSet(new Uri("datacollector://microsoft/CodeCoverage/2.0"), "Code Coverage") diff --git a/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/Microsoft.TestPlatform.ObjectModel.PlatformTests.csproj b/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/Microsoft.TestPlatform.ObjectModel.PlatformTests.csproj index f0b70feee4..57bd0804b8 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/Microsoft.TestPlatform.ObjectModel.PlatformTests.csproj +++ b/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/Microsoft.TestPlatform.ObjectModel.PlatformTests.csproj @@ -2,6 +2,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Microsoft.TestPlatform.ObjectModel.UnitTests.csproj b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Microsoft.TestPlatform.ObjectModel.UnitTests.csproj index 82dc91c1e7..66f705d6e3 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Microsoft.TestPlatform.ObjectModel.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Microsoft.TestPlatform.ObjectModel.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/RunSettings/RunConfigurationTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/RunSettings/RunConfigurationTests.cs index ebd1456960..cb14ddbb71 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/RunSettings/RunConfigurationTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/RunSettings/RunConfigurationTests.cs @@ -94,7 +94,7 @@ public void RunConfigurationReadsValuesCorrectlyFromXml() Assert.AreEqual("TestResults", runConfiguration.ResultsDirectory); - var expectedSolutionPath = Environment.ExpandEnvironmentVariables("%temp%"); + var expectedSolutionPath = Environment.GetEnvironmentVariable("temp"); Assert.AreEqual(expectedSolutionPath, runConfiguration.SolutionDirectory); Assert.IsTrue(runConfiguration.TreatTestAdapterErrorsAsWarnings); diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/XmlRunSettingsUtilitiesTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/XmlRunSettingsUtilitiesTests.cs index 6c829faafe..835354ade6 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/XmlRunSettingsUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/XmlRunSettingsUtilitiesTests.cs @@ -291,8 +291,13 @@ public void GetInProcDataCollectionRunSettingsThrowsExceptionWhenXMLNotValid() public void CreateDefaultRunSettingsShouldReturnABasicRunSettings() { var defaultRunSettings = XmlRunSettingsUtilities.CreateDefaultRunSettings().CreateNavigator().OuterXml; - var expectedRunSettings = - "\r\n \r\n \r\n \r\n"; + var expectedRunSettings = string.Join(Environment.NewLine, + "", + " ", + " ", + " ", + "" + ); Assert.AreEqual(expectedRunSettings, defaultRunSettings); } diff --git a/test/Microsoft.TestPlatform.PerformanceTests/Microsoft.TestPlatform.PerformanceTests.csproj b/test/Microsoft.TestPlatform.PerformanceTests/Microsoft.TestPlatform.PerformanceTests.csproj index ffa9136e2b..ce245f448d 100644 --- a/test/Microsoft.TestPlatform.PerformanceTests/Microsoft.TestPlatform.PerformanceTests.csproj +++ b/test/Microsoft.TestPlatform.PerformanceTests/Microsoft.TestPlatform.PerformanceTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.SmokeTests/Microsoft.TestPlatform.SmokeTests.csproj b/test/Microsoft.TestPlatform.SmokeTests/Microsoft.TestPlatform.SmokeTests.csproj index 54c23733fe..4018e607a6 100644 --- a/test/Microsoft.TestPlatform.SmokeTests/Microsoft.TestPlatform.SmokeTests.csproj +++ b/test/Microsoft.TestPlatform.SmokeTests/Microsoft.TestPlatform.SmokeTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs index 4e1f1eb0b6..47f7e9f958 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs @@ -232,6 +232,7 @@ public void GetTestPlatformExtensionsShouldNotExcludeOutputDirectoryExtensionsIf } [TestMethod] + [TestCategory("Windows")] public void GetTestPlatformExtensionsShouldIncludeOutputDirectoryExtensionsIfTestAdapterPathIsNotSet() { List sourcesDir = new List { "C:\\Source1", "C:\\Source2" }; @@ -260,6 +261,7 @@ public void GetTestPlatformExtensionsShouldIncludeOutputDirectoryExtensionsIfTes } [TestMethod] + [TestCategory("Windows")] public void GetTestPlatformExtensionsShouldReturnPathTheHigherVersionedFileExtensions() { List sourcesDir = new List { "C:\\Source1", "C:\\Source2" }; @@ -285,6 +287,7 @@ public void GetTestPlatformExtensionsShouldReturnPathTheHigherVersionedFileExten } [TestMethod] + [TestCategory("Windows")] public void GetTestPlatformExtensionsShouldReturnPathToSingleFileExtensionOfATypeIfVersionsAreSame() { List sourcesDir = new List { "C:\\Source1", "C:\\Source2" }; @@ -395,6 +398,7 @@ public void LaunchTestHostShouldSetExitCallbackInCaseCustomHost() } [TestMethod] + [TestCategory("Windows")] public void GetTestSourcesShouldReturnAppropriateSourceIfAppxRecipeIsProvided() { var sourcePath = Path.Combine(Path.GetDirectoryName(typeof(TestableTestHostManager).GetTypeInfo().Assembly.GetAssemblyLocation()), @"..\..\..\..\TestAssets\UWPTestAssets\UnitTestApp8.build.appxrecipe"); @@ -404,6 +408,7 @@ public void GetTestSourcesShouldReturnAppropriateSourceIfAppxRecipeIsProvided() } [TestMethod] + [TestCategory("Windows")] public void AppxManifestFileShouldReturnAppropriateSourceIfAppxManifestIsProvided() { var appxManifestPath = Path.Combine(Path.GetDirectoryName(typeof(TestableTestHostManager).GetTypeInfo().Assembly.GetAssemblyLocation()), @"..\..\..\..\TestAssets\UWPTestAssets\AppxManifest.xml"); diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs index d602d8bcbb..5ff6bb08bb 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -57,6 +57,8 @@ public class DotnetTestHostManagerTests private int testHostId; + private string temp = Path.GetTempPath(); + public DotnetTestHostManagerTests() { this.mockTestHostLauncher = new Mock(); @@ -66,8 +68,8 @@ public DotnetTestHostManagerTests() this.mockEnvironment = new Mock(); this.defaultConnectionInfo = new TestRunnerConnectionInfo { Port = 123, ConnectionInfo = new TestHostConnectionInfo { Endpoint = "127.0.0.1:123", Role = ConnectionRole.Client }, RunnerProcessId = 0 }; - string defaultSourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); - this.defaultTestHostPath = @"\tmp\testhost.dll"; + string defaultSourcePath = Path.Combine(this.temp, "test.dll"); + this.defaultTestHostPath = Path.Combine(this.temp, "testhost.dll"); this.dotnetHostManager = new TestableDotnetTestHostManager( this.mockProcessHelper.Object, this.mockFileHelper.Object, @@ -82,6 +84,14 @@ public DotnetTestHostManagerTests() this.mockProcessHelper.Setup(ph => ph.GetTestEngineDirectory()).Returns(DefaultDotnetPath); this.mockFileHelper.Setup(ph => ph.Exists(this.defaultTestHostPath)).Returns(true); + this.mockTestHostLauncher + .Setup(th => th.LaunchTestHost(It.IsAny(), It.IsAny())) + .Returns(Process.GetCurrentProcess().Id); + + this.mockTestHostLauncher + .Setup(th => th.LaunchTestHost(It.IsAny())) + .Returns(Process.GetCurrentProcess().Id); + this.defaultTestProcessStartInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { defaultSourcePath }, null, this.defaultConnectionInfo); } @@ -292,6 +302,7 @@ public void GetTestHostProcessStartInfoShouldUseDotnetHostPathFromRunsettings() } [TestMethod] + [TestCategory("Windows")] public void GetTestHostProcessStartInfoShouldUseTestHostExeFromNugetIfNotFoundInSourceLocation() { var testhostExePath = "testhost.exe"; @@ -299,7 +310,7 @@ public void GetTestHostProcessStartInfoShouldUseTestHostExeFromNugetIfNotFoundIn this.mockFileHelper.Setup(ph => ph.Exists(testhostExePath)).Returns(false); this.mockFileHelper.Setup(ph => ph.Exists("C:\\packages\\microsoft.testplatform.testhost\\15.0.0-Dev\\build\\netcoreapp2.1\\x64\\testhost.exe")).Returns(true); this.mockEnvironment.Setup(ev => ev.OperatingSystem).Returns(PlatformOperatingSystem.Windows); - var sourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); + var sourcePath = Path.Combine(this.temp, "test.dll"); string runtimeConfigFileContent = @"{ @@ -345,12 +356,12 @@ public void GetTestHostProcessStartInfoShouldUseTestHostExeFromNugetIfNotFoundIn }"; MemoryStream runtimeConfigStream = new MemoryStream(Encoding.UTF8.GetBytes(runtimeConfigFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.runtimeconfig.dev.json", FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.runtimeconfig.dev.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.runtimeconfig.dev.json"), FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.runtimeconfig.dev.json"))).Returns(true); MemoryStream depsFileStream = new MemoryStream(Encoding.UTF8.GetBytes(depsFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.deps.json", FileMode.Open, FileAccess.Read)).Returns(depsFileStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.deps.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.deps.json"), FileMode.Open, FileAccess.Read)).Returns(depsFileStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.deps.json"))).Returns(true); string testHostFullPath = @"C:\packages\microsoft.testplatform.testhost/15.0.0-Dev\lib/netstandard1.5/testhost.dll"; this.mockFileHelper.Setup(ph => ph.Exists(testHostFullPath)).Returns(true); @@ -361,14 +372,15 @@ public void GetTestHostProcessStartInfoShouldUseTestHostExeFromNugetIfNotFoundIn } [TestMethod] + [TestCategory("Windows")] public void GetTestHostProcessStartInfoShouldUseTestHostX86ExeFromNugetIfNotFoundInSourceLocation() { var testhostExePath = "testhost.x86.exe"; this.dotnetHostManager.Initialize(this.mockMessageLogger.Object, "x86"); this.mockFileHelper.Setup(ph => ph.Exists(testhostExePath)).Returns(false); - this.mockFileHelper.Setup(ph => ph.Exists("C:\\packages\\microsoft.testplatform.testhost\\15.0.0-Dev\\build\\netcoreapp2.1\\x86\\testhost.x86.exe")).Returns(true); + this.mockFileHelper.Setup(ph => ph.Exists($"C:\\packages{Path.DirectorySeparatorChar}microsoft.testplatform.testhost\\15.0.0-Dev{Path.DirectorySeparatorChar}build\\netcoreapp2.1\\x86\\testhost.x86.exe")).Returns(true); this.mockEnvironment.Setup(ev => ev.OperatingSystem).Returns(PlatformOperatingSystem.Windows); - var sourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); + var sourcePath = Path.Combine(this.temp, "test.dll"); string runtimeConfigFileContent = @"{ @@ -414,14 +426,14 @@ public void GetTestHostProcessStartInfoShouldUseTestHostX86ExeFromNugetIfNotFoun }"; MemoryStream runtimeConfigStream = new MemoryStream(Encoding.UTF8.GetBytes(runtimeConfigFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.runtimeconfig.dev.json", FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.runtimeconfig.dev.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.runtimeconfig.dev.json"), FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.runtimeconfig.dev.json"))).Returns(true); MemoryStream depsFileStream = new MemoryStream(Encoding.UTF8.GetBytes(depsFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.deps.json", FileMode.Open, FileAccess.Read)).Returns(depsFileStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.deps.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.deps.json"), FileMode.Open, FileAccess.Read)).Returns(depsFileStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.deps.json"))).Returns(true); - string testHostFullPath = @"C:\packages\microsoft.testplatform.testhost/15.0.0-Dev\lib/netstandard1.5/testhost.dll"; + string testHostFullPath = $@"C:\packages{Path.DirectorySeparatorChar}microsoft.testplatform.testhost/15.0.0-Dev{Path.DirectorySeparatorChar}lib/netstandard1.5/testhost.dll"; this.mockFileHelper.Setup(ph => ph.Exists(testHostFullPath)).Returns(true); var startInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, this.defaultConnectionInfo); @@ -484,6 +496,7 @@ public void DotnetTestHostManagerShouldNotBeShared() } [TestMethod] + [TestCategory("Windows")] public void GetTestHostProcessStartInfoOnWindowsForValidPathReturnsFullPathOfDotnetHost() { // To validate the else part, set current process to exe other than dotnet @@ -544,11 +557,11 @@ public void GetTestHostProcessStartInfoShouldThrowExceptionWhenDotnetIsNotInstal public void GetTestHostProcessStartInfoShouldIncludeSourceDirectoryAsWorkingDirectory() { // Absolute path to the source directory - var sourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); - this.mockFileHelper.Setup(ph => ph.Exists(@"\tmp\testhost.dll")).Returns(true); + var sourcePath = Path.Combine(this.temp, "test.dll"); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "testhost.dll"))).Returns(true); var startInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, this.defaultConnectionInfo); - Assert.AreEqual($"{Path.DirectorySeparatorChar}tmp", startInfo.WorkingDirectory); + Assert.AreEqual(Path.GetDirectoryName(this.temp), startInfo.WorkingDirectory); } [TestMethod] @@ -619,10 +632,10 @@ public void LaunchTestHostShouldSetExitCallBackInCaseCustomHost() public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromSourceDirectoryIfDepsFileNotFound() { // Absolute path to the source directory - var sourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); - string expectedTestHostPath = @"\tmp\testhost.dll"; + var sourcePath = Path.Combine(this.temp, "test.dll"); + string expectedTestHostPath = Path.Combine(this.temp, "testhost.dll"); this.mockFileHelper.Setup(ph => ph.Exists(expectedTestHostPath)).Returns(true); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.runtimeconfig.dev.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.runtimeconfig.dev.json"))).Returns(true); var startInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, this.defaultConnectionInfo); @@ -633,10 +646,10 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromSourceDirect public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromSourceDirectoryIfRunConfigDevFileNotFound() { // Absolute path to the source directory - var sourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); - string expectedTestHostPath = @"\tmp\testhost.dll"; + var sourcePath = Path.Combine(this.temp, "test.dll"); + string expectedTestHostPath = Path.Combine(this.temp, "testhost.dll"); this.mockFileHelper.Setup(ph => ph.Exists(expectedTestHostPath)).Returns(true); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.deps.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.deps.json"))).Returns(true); var startInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, this.defaultConnectionInfo); @@ -647,7 +660,7 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromSourceDirect public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromDepsFile() { // Absolute path to the source directory - var sourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); + var sourcePath = Path.Combine(this.temp, "test.dll"); string runtimeConfigFileContent = @"{ @@ -693,14 +706,14 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromDepsFile() }"; MemoryStream runtimeConfigStream = new MemoryStream(Encoding.UTF8.GetBytes(runtimeConfigFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.runtimeconfig.dev.json", FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.runtimeconfig.dev.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.runtimeconfig.dev.json"), FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.runtimeconfig.dev.json"))).Returns(true); MemoryStream depsFileStream = new MemoryStream(Encoding.UTF8.GetBytes(depsFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.deps.json", FileMode.Open, FileAccess.Read)).Returns(depsFileStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.deps.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.deps.json"), FileMode.Open, FileAccess.Read)).Returns(depsFileStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.deps.json"))).Returns(true); - string testHostFullPath = @"C:\packages\microsoft.testplatform.testhost/15.0.0-Dev\lib/netstandard1.5/testhost.dll"; + string testHostFullPath = $@"C:\packages{Path.DirectorySeparatorChar}microsoft.testplatform.testhost/15.0.0-Dev{Path.DirectorySeparatorChar}lib/netstandard1.5/testhost.dll"; this.mockFileHelper.Setup(ph => ph.Exists(testHostFullPath)).Returns(true); var startInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, this.defaultConnectionInfo); @@ -712,7 +725,7 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromDepsFile() public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromSourceDirectoryIfNugetpathDoesntExist() { // Absolute path to the source directory - var sourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); + var sourcePath = Path.Combine(this.temp, "test.dll"); string runtimeConfigFileContent = @"{ @@ -758,17 +771,17 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromSourceDirect }"; MemoryStream runtimeConfigStream = new MemoryStream(Encoding.UTF8.GetBytes(runtimeConfigFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.runtimeconfig.dev.json", FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.runtimeconfig.dev.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.runtimeconfig.dev.json"), FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.runtimeconfig.dev.json"))).Returns(true); MemoryStream depsFileStream = new MemoryStream(Encoding.UTF8.GetBytes(depsFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.deps.json", FileMode.Open, FileAccess.Read)).Returns(depsFileStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.deps.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.deps.json"), FileMode.Open, FileAccess.Read)).Returns(depsFileStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.deps.json"))).Returns(true); - string testHostFullPath = @"C:\packages\microsoft.testplatform.testhost/15.0.0-Dev\lib/netstandard1.5/testhost.dll"; + string testHostFullPath = $@"C:\packages{Path.DirectorySeparatorChar}microsoft.testplatform.testhost/15.0.0-Dev{Path.DirectorySeparatorChar}lib/netstandard1.5/testhost.dll"; this.mockFileHelper.Setup(ph => ph.Exists(testHostFullPath)).Returns(false); - string testHostPath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "testhost.dll"); + string testHostPath = Path.Combine(this.temp, "testhost.dll"); var startInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, this.defaultConnectionInfo); @@ -779,7 +792,7 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromSourceDirect public void GetTestHostProcessStartInfoShouldSkipInvalidAdditionalProbingPaths() { // Absolute path to the source directory - var sourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); + var sourcePath = Path.Combine(this.temp, "test.dll"); string runtimeConfigFileContent = @"{ @@ -826,14 +839,14 @@ public void GetTestHostProcessStartInfoShouldSkipInvalidAdditionalProbingPaths() }"; MemoryStream runtimeConfigStream = new MemoryStream(Encoding.UTF8.GetBytes(runtimeConfigFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.runtimeconfig.dev.json", FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.runtimeconfig.dev.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.runtimeconfig.dev.json"), FileMode.Open, FileAccess.Read)).Returns(runtimeConfigStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.runtimeconfig.dev.json"))).Returns(true); MemoryStream depsFileStream = new MemoryStream(Encoding.UTF8.GetBytes(depsFileContent)); - this.mockFileHelper.Setup(ph => ph.GetStream("\\tmp\\test.deps.json", FileMode.Open, FileAccess.Read)).Returns(depsFileStream); - this.mockFileHelper.Setup(ph => ph.Exists("\\tmp\\test.deps.json")).Returns(true); + this.mockFileHelper.Setup(ph => ph.GetStream(Path.Combine(this.temp, "test.deps.json"), FileMode.Open, FileAccess.Read)).Returns(depsFileStream); + this.mockFileHelper.Setup(ph => ph.Exists(Path.Combine(this.temp, "test.deps.json"))).Returns(true); - string testHostFullPath = @"C:\packages\microsoft.testplatform.testhost/15.0.0-Dev\lib/netstandard1.5/testhost.dll"; + string testHostFullPath = $@"C:\packages{Path.DirectorySeparatorChar}microsoft.testplatform.testhost/15.0.0-Dev{Path.DirectorySeparatorChar}lib/netstandard1.5/testhost.dll"; this.mockFileHelper.Setup(ph => ph.Exists(testHostFullPath)).Returns(true); var startInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, this.defaultConnectionInfo); diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Microsoft.TestPlatform.TestHostProvider.UnitTests.csproj b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Microsoft.TestPlatform.TestHostProvider.UnitTests.csproj index bd0cbba8ac..5a2219e9c1 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Microsoft.TestPlatform.TestHostProvider.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Microsoft.TestPlatform.TestHostProvider.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/Microsoft.TestPlatform.TestUtilities/Microsoft.TestPlatform.TestUtilities.csproj b/test/Microsoft.TestPlatform.TestUtilities/Microsoft.TestPlatform.TestUtilities.csproj index 845d11a215..4f8b9e4dec 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/Microsoft.TestPlatform.TestUtilities.csproj +++ b/test/Microsoft.TestPlatform.TestUtilities/Microsoft.TestPlatform.TestUtilities.csproj @@ -10,6 +10,7 @@ true + true @@ -17,6 +18,7 @@ + $(MSTestFrameworkVersion) diff --git a/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs b/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs new file mode 100644 index 0000000000..869d8897d7 --- /dev/null +++ b/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; +using Microsoft.VisualStudio.TestPlatform.Common.SettingsProvider; +using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; +using Moq; +using System; +using System.Linq; +using System.Reflection; + +namespace Microsoft.TestPlatform.TestUtilities +{ + public static class TestPluginCacheHelper + { + public static TestableTestPluginCache SetupMockAdditionalPathExtensions(Type callingTest) + { + return SetupMockAdditionalPathExtensions( + new string[] { callingTest.GetTypeInfo().Assembly.Location }); + } + + public static TestableTestPluginCache SetupMockAdditionalPathExtensions(string[] extensions) + { + var mockFileHelper = new Mock(); + var testPluginCache = new TestableTestPluginCache(); + + TestPluginCache.Instance = testPluginCache; + + // Stub the default extensions folder. + mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(false); + + TestPluginCache.Instance.UpdateExtensions(extensions, true); + + return testPluginCache; + } + + public static void SetupMockExtensions(Type callingTest, Mock mockFileHelper = null) + { + SetupMockExtensions(callingTest, () => { }, mockFileHelper); + } + + public static void SetupMockExtensions(Type callingTest, Action callback, Mock mockFileHelper = null) + { + SetupMockExtensions(new[] { callingTest.GetTypeInfo().Assembly.Location }, callback, mockFileHelper); + } + + public static void SetupMockExtensions(string[] extensions, Action callback, Mock mockFileHelper = null) + { + // Setup mocks. + if (mockFileHelper == null) + { + mockFileHelper = new Mock(); + } + + mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); + + var testableTestPluginCache = new TestableTestPluginCache(extensions.ToList()); + testableTestPluginCache.Action = callback; + + // Setup the testable instance. + TestPluginCache.Instance = testableTestPluginCache; + } + + public static void ResetExtensionsCache() + { + TestPluginCache.Instance = null; + SettingsProviderExtensionManager.Destroy(); + } + } +} diff --git a/test/Microsoft.TestPlatform.TestUtilities/TestableTestPluginCache.cs b/test/Microsoft.TestPlatform.TestUtilities/TestableTestPluginCache.cs new file mode 100644 index 0000000000..58c234b378 --- /dev/null +++ b/test/Microsoft.TestPlatform.TestUtilities/TestableTestPluginCache.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.TestUtilities +{ + using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; + using Microsoft.VisualStudio.TestPlatform.Common.SettingsProvider; + using System; + using System.Collections.Generic; + + public class TestableTestPluginCache : TestPluginCache + { + public Action Action; + public TestableTestPluginCache(List extensionsPath) + { + TestDiscoveryExtensionManager.Destroy(); + TestExecutorExtensionManager.Destroy(); + SettingsProviderExtensionManager.Destroy(); + this.UpdateExtensions(extensionsPath, skipExtensionFilters: false); + } + + public TestableTestPluginCache() : this(new List()) + { + } + + protected override IEnumerable GetFilteredExtensions(List extensions, string searchPattern) + { + this.Action?.Invoke(); + return extensions; + } + + new public void SetupAssemblyResolver(string extensionAssembly) + { + base.SetupAssemblyResolver(extensionAssembly); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs index c6f647e663..1616cbd9f4 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs @@ -77,7 +77,8 @@ public void FixRelativePathsInRunSettingsShouldModifyRelativeTestSettingsFilePat [TestMethod] public void FixRelativePathsInRunSettingsShouldNotModifyAbsoluteTestSettingsFilePath() { - var runSettingsXML = "C:\\temp\\remote.testsettings"; + var absolutePath = Path.Combine(Path.GetTempPath(), "remote.testsettings"); + var runSettingsXML = $"{absolutePath}"; var doc = new XmlDocument(); doc.LoadXml(runSettingsXML); @@ -88,7 +89,7 @@ public void FixRelativePathsInRunSettingsShouldNotModifyAbsoluteTestSettingsFile var finalSettingsXml = doc.OuterXml; - var expectedRunSettingsXML = string.Concat("C:\\temp\\remote.testsettings", + var expectedRunSettingsXML = string.Concat($"{absolutePath}", Path.GetDirectoryName(currentAssemblyLocation), ""); @@ -145,7 +146,8 @@ public void FixRelativePathsInRunSettingsShouldModifyRelativeResultsDirectory() [TestMethod] public void FixRelativePathsInRunSettingsShouldNotModifyAbsoluteResultsDirectory() { - var runSettingsXML = "C:\\temp\\results"; + var absolutePath = Path.Combine(Path.GetTempPath(), "results"); + var runSettingsXML = $"{absolutePath}"; var doc = new XmlDocument(); doc.LoadXml(runSettingsXML); @@ -156,7 +158,7 @@ public void FixRelativePathsInRunSettingsShouldNotModifyAbsoluteResultsDirectory var finalSettingsXml = doc.OuterXml; - var expectedRunSettingsXML = string.Concat("C:\\temp\\results", + var expectedRunSettingsXML = string.Concat($"{absolutePath}", Path.GetDirectoryName(currentAssemblyLocation), ""); @@ -187,27 +189,35 @@ public void FixRelativePathsInRunSettingsShouldNotModifyEmptyResultsDirectory() [TestMethod] public void FixRelativePathsInRunSettingsShouldExpandEnvironmentVariable() { - var runSettingsXML = "%temp%\\results"; - - var doc = new XmlDocument(); - doc.LoadXml(runSettingsXML); - - var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; - - ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); - - var finalSettingsXml = doc.OuterXml; - - var expectedPath = Environment.ExpandEnvironmentVariables("%temp%\\results"); - - var expectedSettingsXml = string.Concat( - "", - expectedPath, - "", - Path.GetDirectoryName(currentAssemblyLocation), - ""); - - Assert.AreEqual(expectedSettingsXml, finalSettingsXml); + try { + Environment.SetEnvironmentVariable("TEST_TEMP", Path.GetTempPath()); + // using TEST_TEMP because TMP or TEMP, or HOME are not defined across all tested OSes + // Using \\ instead of platform specifc path separator does not matter, because the paths are not interpreted by the OS. + var runSettingsXML = "%TEST_TEMP%\\results"; + + var doc = new XmlDocument(); + doc.LoadXml(runSettingsXML); + + var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; + + ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); + + var finalSettingsXml = doc.OuterXml; + + var expectedPath = $"{Environment.GetEnvironmentVariable("TEST_TEMP")}\\results"; + + var expectedSettingsXml = string.Concat( + "", + expectedPath, + "", + Path.GetDirectoryName(currentAssemblyLocation), + ""); + + Assert.AreEqual(expectedSettingsXml, finalSettingsXml); + } + finally { + Environment.SetEnvironmentVariable("TEST_TEMP", null); + } } } } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs index 567454ac92..366e32871a 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs @@ -79,14 +79,15 @@ public void ImportShouldEmbedTestSettingsInformation() var finalSettingsXml = finalxPath.CreateNavigator().OuterXml; - var expectedSettingsXml = - "\r\n" + - " \r\n" + - " C:\\temp\\r.testsettings\r\n" + - " true\r\n" + - " \r\n" + - " \r\n" + - ""; + var expectedSettingsXml = string.Join(Environment.NewLine, + "", + " ", + " C:\\temp\\r.testsettings", + " true", + " ", + " ", + "" + ); Assert.AreEqual(expectedSettingsXml, finalSettingsXml); } @@ -103,14 +104,15 @@ public void ImportShouldEmbedTestSettingsAndDefaultRunConfigurationInformation() var finalSettingsXml = finalxPath.CreateNavigator().OuterXml; - var expectedSettingsXml = - "\r\n" + - " \r\n" + - " \r\n" + - " C:\\temp\\r.testsettings\r\n" + - " true\r\n" + - " \r\n" + - ""; + var expectedSettingsXml = string.Join(Environment.NewLine, + "", + " ", + " ", + " C:\\temp\\r.testsettings", + " true", + " ", + "" + ); Assert.AreEqual(expectedSettingsXml, finalSettingsXml); } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj b/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj index 47ac9bd9b4..2ebc55f972 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj index 038ae2f4be..0c0c7f839c 100644 --- a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/TestAssets/BlameUnitTestProject/BlameUnitTestProject.csproj b/test/TestAssets/BlameUnitTestProject/BlameUnitTestProject.csproj index 0af41206e5..95e4dc085b 100644 --- a/test/TestAssets/BlameUnitTestProject/BlameUnitTestProject.csproj +++ b/test/TestAssets/BlameUnitTestProject/BlameUnitTestProject.csproj @@ -4,6 +4,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/CUITTestProject/CUITTestProject.csproj b/test/TestAssets/CUITTestProject/CUITTestProject.csproj index 4e3ebb9ec4..57493311c9 100644 --- a/test/TestAssets/CUITTestProject/CUITTestProject.csproj +++ b/test/TestAssets/CUITTestProject/CUITTestProject.csproj @@ -4,6 +4,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/DisableAppdomainTest1/DisableAppdomainTest1.csproj b/test/TestAssets/DisableAppdomainTest1/DisableAppdomainTest1.csproj index 01c840248d..7799703482 100644 --- a/test/TestAssets/DisableAppdomainTest1/DisableAppdomainTest1.csproj +++ b/test/TestAssets/DisableAppdomainTest1/DisableAppdomainTest1.csproj @@ -4,6 +4,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/DisableAppdomainTest2/DisableAppdomainTest2.csproj b/test/TestAssets/DisableAppdomainTest2/DisableAppdomainTest2.csproj index de41ee4f68..9402b7930a 100644 --- a/test/TestAssets/DisableAppdomainTest2/DisableAppdomainTest2.csproj +++ b/test/TestAssets/DisableAppdomainTest2/DisableAppdomainTest2.csproj @@ -4,6 +4,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/EventLogUnitTestProject/EventLogUnitTestProject.csproj b/test/TestAssets/EventLogUnitTestProject/EventLogUnitTestProject.csproj index 1c011d4f25..d5ca3ee3e7 100644 --- a/test/TestAssets/EventLogUnitTestProject/EventLogUnitTestProject.csproj +++ b/test/TestAssets/EventLogUnitTestProject/EventLogUnitTestProject.csproj @@ -4,6 +4,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/LegacySettingsUnitTestProject/LegacySettingsUnitTestProject.csproj b/test/TestAssets/LegacySettingsUnitTestProject/LegacySettingsUnitTestProject.csproj index f4349195a1..8b43b39843 100644 --- a/test/TestAssets/LegacySettingsUnitTestProject/LegacySettingsUnitTestProject.csproj +++ b/test/TestAssets/LegacySettingsUnitTestProject/LegacySettingsUnitTestProject.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/MstestV1UnitTestProject/MstestV1UnitTestProject.csproj b/test/TestAssets/MstestV1UnitTestProject/MstestV1UnitTestProject.csproj index 6be1dc6e80..dde1b00f8d 100644 --- a/test/TestAssets/MstestV1UnitTestProject/MstestV1UnitTestProject.csproj +++ b/test/TestAssets/MstestV1UnitTestProject/MstestV1UnitTestProject.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/MultitargetedNetFrameworkProject/MultitargetedNetFrameworkProject.csproj b/test/TestAssets/MultitargetedNetFrameworkProject/MultitargetedNetFrameworkProject.csproj index 558f07b7d5..0bb4406ec3 100644 Binary files a/test/TestAssets/MultitargetedNetFrameworkProject/MultitargetedNetFrameworkProject.csproj and b/test/TestAssets/MultitargetedNetFrameworkProject/MultitargetedNetFrameworkProject.csproj differ diff --git a/test/TestAssets/NewtonSoftDependency/NewtonSoftDependency.csproj b/test/TestAssets/NewtonSoftDependency/NewtonSoftDependency.csproj index 6c6d7139b4..52bef29035 100644 --- a/test/TestAssets/NewtonSoftDependency/NewtonSoftDependency.csproj +++ b/test/TestAssets/NewtonSoftDependency/NewtonSoftDependency.csproj @@ -4,6 +4,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/PerfTestProject/PerfTestProject.csproj b/test/TestAssets/PerfTestProject/PerfTestProject.csproj index 434083b95b..bf40e53d92 100644 Binary files a/test/TestAssets/PerfTestProject/PerfTestProject.csproj and b/test/TestAssets/PerfTestProject/PerfTestProject.csproj differ diff --git a/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj b/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj index a0e6a3264b..6d80ef0cf7 100644 Binary files a/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj and b/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj differ diff --git a/test/TestAssets/SimpleTestProjectARM/SimpleTestProjectARM.csproj b/test/TestAssets/SimpleTestProjectARM/SimpleTestProjectARM.csproj index 77d42ad890..ccf16eee85 100644 Binary files a/test/TestAssets/SimpleTestProjectARM/SimpleTestProjectARM.csproj and b/test/TestAssets/SimpleTestProjectARM/SimpleTestProjectARM.csproj differ diff --git a/test/TestAssets/SimpleTestProjectx86/SimpleTestProjectx86.csproj b/test/TestAssets/SimpleTestProjectx86/SimpleTestProjectx86.csproj index b01034504f..0dc97a4cc2 100644 Binary files a/test/TestAssets/SimpleTestProjectx86/SimpleTestProjectx86.csproj and b/test/TestAssets/SimpleTestProjectx86/SimpleTestProjectx86.csproj differ diff --git a/test/TestAssets/XUPerfTestProject/XUPerfTestProject.csproj b/test/TestAssets/XUPerfTestProject/XUPerfTestProject.csproj index 0a0dade194..fa184a7505 100644 --- a/test/TestAssets/XUPerfTestProject/XUPerfTestProject.csproj +++ b/test/TestAssets/XUPerfTestProject/XUPerfTestProject.csproj @@ -8,6 +8,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/child-crash/child-crash.csproj b/test/TestAssets/child-crash/child-crash.csproj index 86196d9554..7ffa671ad8 100644 --- a/test/TestAssets/child-crash/child-crash.csproj +++ b/test/TestAssets/child-crash/child-crash.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/child-hang/child-hang.csproj b/test/TestAssets/child-hang/child-hang.csproj index 3a85ae0c98..159d792111 100644 --- a/test/TestAssets/child-hang/child-hang.csproj +++ b/test/TestAssets/child-hang/child-hang.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/crash/crash.csproj b/test/TestAssets/crash/crash.csproj index 1ed7040168..1f982c0dbf 100644 --- a/test/TestAssets/crash/crash.csproj +++ b/test/TestAssets/crash/crash.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/hanging-child/hanging-child.csproj b/test/TestAssets/hanging-child/hanging-child.csproj index 767cd7f2ea..aa1759b248 100644 --- a/test/TestAssets/hanging-child/hanging-child.csproj +++ b/test/TestAssets/hanging-child/hanging-child.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/problematic-child/problematic-child.csproj b/test/TestAssets/problematic-child/problematic-child.csproj index 2a504e5180..23ae1ba0e7 100644 --- a/test/TestAssets/problematic-child/problematic-child.csproj +++ b/test/TestAssets/problematic-child/problematic-child.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/TestAssets/timeout/timeout.csproj b/test/TestAssets/timeout/timeout.csproj index ef9860b43f..6b22ca3747 100644 --- a/test/TestAssets/timeout/timeout.csproj +++ b/test/TestAssets/timeout/timeout.csproj @@ -3,6 +3,7 @@ ..\..\..\ true + true diff --git a/test/TranslationLayer.UnitTests/TranslationLayer.UnitTests.csproj b/test/TranslationLayer.UnitTests/TranslationLayer.UnitTests.csproj index 7b0352f2cf..bdd32a6254 100644 --- a/test/TranslationLayer.UnitTests/TranslationLayer.UnitTests.csproj +++ b/test/TranslationLayer.UnitTests/TranslationLayer.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj b/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj index 5c1834b815..844c320419 100644 --- a/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj +++ b/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj @@ -2,6 +2,7 @@ ..\..\ true + true diff --git a/test/datacollector.UnitTests/datacollector.UnitTests.csproj b/test/datacollector.UnitTests/datacollector.UnitTests.csproj index e4dd4abe91..654ba2c74c 100644 --- a/test/datacollector.UnitTests/datacollector.UnitTests.csproj +++ b/test/datacollector.UnitTests/datacollector.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/testhost.UnitTests/testhost.UnitTests.csproj b/test/testhost.UnitTests/testhost.UnitTests.csproj index c375bca951..5274cc7dea 100644 --- a/test/testhost.UnitTests/testhost.UnitTests.csproj +++ b/test/testhost.UnitTests/testhost.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/vstest.console.PlatformTests/vstest.console.PlatformTests.csproj b/test/vstest.console.PlatformTests/vstest.console.PlatformTests.csproj index 558345fa87..e2de007564 100644 --- a/test/vstest.console.PlatformTests/vstest.console.PlatformTests.csproj +++ b/test/vstest.console.PlatformTests/vstest.console.PlatformTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true diff --git a/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs b/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs index 224ef35f92..b4dc8ff3a5 100644 --- a/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs +++ b/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs @@ -87,7 +87,7 @@ public void CommandLineOptionsAddSourceShouldThrowCommandLineExceptionForInvalid [TestMethod] public void CommandLineOptionsAddSourceShouldAddSourceForValidSource() { - string testFilePath = "C:\\DummyTestFile.txt"; + string testFilePath = Path.Combine(Path.GetTempPath(), "DummyTestFile.txt"); this.fileHelper.Setup(fh => fh.Exists(testFilePath)).Returns(true); CommandLineOptions.Instance.AddSource(testFilePath); diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 45cc4f5553..bbbc7719d8 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -7,6 +7,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Internal using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; + using System.IO; using System.Linq; using System.Threading; using Microsoft.Extensions.FileSystemGlobbing; @@ -942,7 +943,7 @@ public void TestRunStartHandlerShouldWriteNumberOfTestSourcesDiscoveredOnConsole CommandLineOptions.Instance.Reset(); CommandLineOptions.Instance.FileHelper = fileHelper.Object; CommandLineOptions.Instance.FilePatternParser = new FilePatternParser(new Mock().Object, fileHelper.Object); - string testFilePath = "C:\\DummyTestFile.dll"; + string testFilePath = Path.Combine(Path.GetTempPath(), "DmmyTestFile.dll"); fileHelper.Setup(fh => fh.Exists(testFilePath)).Returns(true); CommandLineOptions.Instance.AddSource(testFilePath); @@ -951,7 +952,7 @@ public void TestRunStartHandlerShouldWriteNumberOfTestSourcesDiscoveredOnConsole parameters.Add("verbosity", "normal"); this.consoleLogger.Initialize(loggerEvents, parameters); - var testRunStartEventArgs = new TestRunStartEventArgs(new TestRunCriteria(new List { "C:\\DummyTestFile.dll" }, 1)); + var testRunStartEventArgs = new TestRunStartEventArgs(new TestRunCriteria(new List { testFilePath }, 1)); loggerEvents.RaiseTestRunStart(testRunStartEventArgs); loggerEvents.WaitForEventCompletion(); @@ -968,9 +969,10 @@ public void TestRunStartHandlerShouldWriteTestSourcesDiscoveredOnConsoleIfVerbos CommandLineOptions.Instance.Reset(); CommandLineOptions.Instance.FileHelper = fileHelper.Object; CommandLineOptions.Instance.FilePatternParser = new FilePatternParser(new Mock().Object, fileHelper.Object); - string testFilePath = "C:\\DummyTestFile.dll"; + var temp = Path.GetTempPath(); + string testFilePath = Path.Combine(temp, "DummyTestFile.dll"); fileHelper.Setup(fh => fh.Exists(testFilePath)).Returns(true); - string testFilePath2 = "C:\\DummyTestFile2.dll"; + string testFilePath2 = Path.Combine(temp, "DummyTestFile2.dll"); fileHelper.Setup(fh => fh.Exists(testFilePath2)).Returns(true); CommandLineOptions.Instance.AddSource(testFilePath); @@ -980,13 +982,13 @@ public void TestRunStartHandlerShouldWriteTestSourcesDiscoveredOnConsoleIfVerbos parameters.Add("verbosity", "detailed"); this.consoleLogger.Initialize(loggerEvents, parameters); - var testRunStartEventArgs = new TestRunStartEventArgs(new TestRunCriteria(new List { "C:\\DummyTestFile.dll" }, 1)); + var testRunStartEventArgs = new TestRunStartEventArgs(new TestRunCriteria(new List { testFilePath }, 1)); loggerEvents.RaiseTestRunStart(testRunStartEventArgs); loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestSourcesDiscovered, CommandLineOptions.Instance.Sources.Count()), OutputLevel.Information), Times.Once()); - this.mockOutput.Verify(o => o.WriteLine("C:\\DummyTestFile.dll", OutputLevel.Information), Times.Once); - this.mockOutput.Verify(o => o.WriteLine("C:\\DummyTestFile2.dll", OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(testFilePath, OutputLevel.Information), Times.Once); + this.mockOutput.Verify(o => o.WriteLine(testFilePath, OutputLevel.Information), Times.Once); } [TestMethod] @@ -999,9 +1001,10 @@ public void TestRunStartHandlerShouldNotWriteTestSourcesDiscoveredOnConsoleIfVer CommandLineOptions.Instance.Reset(); CommandLineOptions.Instance.FileHelper = fileHelper.Object; CommandLineOptions.Instance.FilePatternParser = new FilePatternParser(new Mock().Object, fileHelper.Object); - string testFilePath = "C:\\DummyTestFile.dll"; + var temp = Path.GetTempPath(); + string testFilePath = Path.Combine(temp, "DummyTestFile.dll"); fileHelper.Setup(fh => fh.Exists(testFilePath)).Returns(true); - string testFilePath2 = "C:\\DummyTestFile2.dll"; + string testFilePath2 = Path.Combine(temp, "DummyTestFile2.dll"); fileHelper.Setup(fh => fh.Exists(testFilePath2)).Returns(true); CommandLineOptions.Instance.AddSource(testFilePath); @@ -1011,13 +1014,13 @@ public void TestRunStartHandlerShouldNotWriteTestSourcesDiscoveredOnConsoleIfVer parameters.Add("verbosity", "normal"); this.consoleLogger.Initialize(loggerEvents, parameters); - var testRunStartEventArgs = new TestRunStartEventArgs(new TestRunCriteria(new List { "C:\\DummyTestFile.dll" }, 1)); + var testRunStartEventArgs = new TestRunStartEventArgs(new TestRunCriteria(new List { testFilePath }, 1)); loggerEvents.RaiseTestRunStart(testRunStartEventArgs); loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestSourcesDiscovered, CommandLineOptions.Instance.Sources.Count()), OutputLevel.Information), Times.Once()); - this.mockOutput.Verify(o => o.WriteLine("C:\\DummyTestFile.dll", OutputLevel.Information), Times.Never); - this.mockOutput.Verify(o => o.WriteLine("C:\\DummyTestFile2.dll", OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(testFilePath, OutputLevel.Information), Times.Never); + this.mockOutput.Verify(o => o.WriteLine(testFilePath2, OutputLevel.Information), Times.Never); } [TestMethod] diff --git a/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs b/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs index d0bf2e2fb2..13ae7d8fb8 100644 --- a/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs +++ b/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs @@ -1,6 +1,9 @@ // Copyright(c) Microsoft Corporation.All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using System.Text.RegularExpressions; + namespace vstest.console.UnitTests.Internal { using Microsoft.Extensions.FileSystemGlobbing; @@ -32,11 +35,11 @@ public void FilePatternParserShouldCorrectlySplitPatternAndDirectory() { var patternMatchingResult = new PatternMatchingResult(new List()); this.mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - this.filePatternParser.GetMatchingFiles(@"C:\Users\vanidhi\Desktop\a\c\*bc.dll"); + this.filePatternParser.GetMatchingFiles(TranslatePath(@"C:\Users\vanidhi\Desktop\a\c\*bc.dll")); // Assert - this.mockMatcherHelper.Verify(x => x.AddInclude(@"*bc.dll")); - this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(@"C:\Users\vanidhi\Desktop\a\c")))); + this.mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"*bc.dll"))); + this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"C:\Users\vanidhi\Desktop\a\c"))))); } [TestMethod] @@ -44,11 +47,11 @@ public void FilePatternParserShouldCorrectlySplitWithArbitraryDirectoryDepth() { var patternMatchingResult = new PatternMatchingResult(new List()); this.mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - this.filePatternParser.GetMatchingFiles(@"C:\Users\vanidhi\**\c\*bc.txt"); + this.filePatternParser.GetMatchingFiles(TranslatePath(@"C:\Users\vanidhi\**\c\*bc.txt")); // Assert - this.mockMatcherHelper.Verify(x => x.AddInclude(@"**\c\*bc.txt")); - this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(@"C:\Users\vanidhi")))); + this.mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"**\c\*bc.txt"))); + this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"C:\Users\vanidhi"))))); } [TestMethod] @@ -56,11 +59,11 @@ public void FilePatternParserShouldCorrectlySplitWithWildCardInMultipleDirectory { var patternMatchingResult = new PatternMatchingResult(new List()); this.mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\tests\**.Tests\**\*.Tests.dll"); + this.filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\tests\**.Tests\**\*.Tests.dll")); // Assert - this.mockMatcherHelper.Verify(x => x.AddInclude(@"**.Tests\**\*.Tests.dll")); - this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(@"E:\path\to\project\tests")))); + this.mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"**.Tests\**\*.Tests.dll"))); + this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"E:\path\to\project\tests"))))); } [TestMethod] @@ -68,11 +71,11 @@ public void FilePatternParserShouldCorrectlySplitWithMultpleWildCardInPattern() { var patternMatchingResult = new PatternMatchingResult(new List()); this.mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\tests\Tests*.Blame*.dll"); + this.filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\tests\Tests*.Blame*.dll")); // Assert - this.mockMatcherHelper.Verify(x => x.AddInclude(@"Tests*.Blame*.dll")); - this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(@"E:\path\to\project\tests")))); + this.mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"Tests*.Blame*.dll"))); + this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"E:\path\to\project\tests"))))); } [TestMethod] @@ -80,34 +83,43 @@ public void FilePatternParserShouldCorrectlySplitWithMultpleWildCardInMultipleDi { var patternMatchingResult = new PatternMatchingResult(new List()); this.mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\*tests\Tests*.Blame*.dll"); + this.filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\*tests\Tests*.Blame*.dll")); // Assert - this.mockMatcherHelper.Verify(x => x.AddInclude(@"*tests\Tests*.Blame*.dll")); - this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(@"E:\path\to\project")))); + this.mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"*tests\Tests*.Blame*.dll"))); + this.mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"E:\path\to\project"))))); } [TestMethod] public void FilePatternParserShouldCheckIfFileExistsIfFullPathGiven() { var patternMatchingResult = new PatternMatchingResult(new List()); - this.mockFileHelper.Setup(x => x.Exists(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")).Returns(true); + this.mockFileHelper.Setup(x => x.Exists(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))).Returns(true); this.mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - var matchingFiles = this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"); + var matchingFiles = this.filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); // Assert - this.mockFileHelper.Verify(x => x.Exists(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); - Assert.IsTrue(matchingFiles.Contains(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); + this.mockFileHelper.Verify(x => x.Exists(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))); + Assert.IsTrue(matchingFiles.Contains(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))); } [TestMethod] public void FilePatternParserShouldThrowCommandLineExceptionIfFileDoesNotExist() { var patternMatchingResult = new PatternMatchingResult(new List()); - this.mockFileHelper.Setup(x => x.Exists(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")).Returns(false); + this.mockFileHelper.Setup(x => x.Exists(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))).Returns(false); this.mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - Assert.ThrowsException(() => this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); + Assert.ThrowsException(() => this.filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))); + } + + private string TranslatePath(string path) + { + // RuntimeInformation has conflict when used + if (Environment.OSVersion.Platform.ToString().StartsWith("Win")) + return path; + + return Regex.Replace(path.Replace("\\", "/"), @"(\w)\:/", @"/mnt/$1/"); } } } diff --git a/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs index 9db1d8b408..4b4c0d3546 100644 --- a/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs @@ -20,9 +20,35 @@ public class CLIRunSettingsArgumentProcessorTests private TestableRunSettingsProvider settingsProvider; private CLIRunSettingsArgumentExecutor executor; private CommandLineOptions commandLineOptions; - private const string DefaultRunSettings = "\r\n\r\n \r\n \r\n \r\n"; - private const string RunSettingsWithDeploymentDisabled = "\r\n\r\n \r\n \r\n \r\n \r\n False\r\n \r\n"; - private const string RunSettingsWithDeploymentEnabled = "\r\n\r\n \r\n \r\n \r\n \r\n True\r\n \r\n"; + private readonly string DefaultRunSettings = string.Join(Environment.NewLine, + "", +"", +" ", +" ", +" ", +""); + + private readonly string RunSettingsWithDeploymentDisabled = string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " False", + " ", + ""); + + private readonly string RunSettingsWithDeploymentEnabled = string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " True", + " ", + ""); [TestInitialize] public void Init() @@ -60,7 +86,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() var capabilities = new CLIRunSettingsArgumentProcessorCapabilities(); Assert.AreEqual("--", capabilities.CommandName); - Assert.AreEqual("RunSettings arguments:" + Environment.NewLine + " Arguments to pass runsettings configurations through commandline. Arguments may be specified as name-value pair of the form [name]=[value] after \"-- \". Note the space after --. " + Environment.NewLine + " Use a space to separate multiple [name]=[value]." + Environment.NewLine + " More info on RunSettings arguments support: https://aka.ms/vstest-runsettings-arguments", capabilities.HelpContentResourceName); + var expected = "RunSettings arguments:\r\n Arguments to pass runsettings configurations through commandline. Arguments may be specified as name-value pair of the form [name]=[value] after \"-- \". Note the space after --. \r\n Use a space to separate multiple [name]=[value].\r\n More info on RunSettings arguments support: https://aka.ms/vstest-runsettings-arguments"; + Assert.AreEqual(expected.NormalizeLineEndings().ShowWhiteSpace(), capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.CLIRunSettingsArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsFalse(capabilities.IsAction); @@ -165,7 +192,15 @@ public void InitializeShouldEncodeXMLIfInvalidXMLCharsArePresent() this.executor.Initialize(args); Assert.IsNotNull(this.settingsProvider.ActiveRunSettings); - Assert.AreEqual("\r\n\r\n \r\n \r\n \r\n \r\n F>a><l<se\r\n \r\n", settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, "", +"", +" ", +" ", +" ", +" ", +" F>a><l<se", +" ", +""), settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] @@ -222,7 +257,16 @@ public void InitializeShouldOverwriteValueIfWhitSpaceIsPassedAndNodeAlreadyExist this.executor.Initialize(args); Assert.IsNotNull(this.settingsProvider.ActiveRunSettings); - Assert.AreEqual("\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, "", +"", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +""), settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] @@ -334,16 +378,48 @@ public static IEnumerable TestRunParameterArgValidTestCases() private static readonly List validTestCases = new List { new object[] { "TestRunParameters.Parameter(name=\"weburl\",value=\"&><\")" , - "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n" + string.Join(Environment.NewLine, "", +"", +" ", +" ", +" ", +" ", +" ", +" ", +"") }, new object[] { "TestRunParameters.Parameter(name=\"weburl\",value=\"http://localhost//abc\")" , - "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n" + string.Join(Environment.NewLine, "", +"", +" ", +" ", +" ", +" ", +" ", +" ", +"") }, new object[] { "TestRunParameters.Parameter(name= \"a_sf123_12\",value= \"2324346a!@#$%^*()_+-=':;.,/?{}[]|\")" , - "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n" + string.Join(Environment.NewLine, "", +"", +" ", +" ", +" ", +" ", +" ", +" ", +"") }, new object[] { "TestRunParameters.Parameter(name = \"weburl\" , value = \"http://localhost//abc\")" , - "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n" + string.Join(Environment.NewLine, "", +"", +" ", +" ", +" ", +" ", +" ", +" ", +"") }, }; #endregion diff --git a/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs index b2784dfdd2..8ff80ffbf5 100644 --- a/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs @@ -4,14 +4,16 @@ namespace vstest.console.UnitTests.Processors { using System; - + using System.IO; using Microsoft.VisualStudio.TestPlatform.CommandLine; using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; + using Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests; using Moq; + using static Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.CollectArgumentExecutor; [TestClass] @@ -19,7 +21,17 @@ public class CollectArgumentProcessorTests { private readonly TestableRunSettingsProvider settingsProvider; private readonly CollectArgumentExecutor executor; - private const string DefaultRunSettings = "\r\n\r\n \r\n c:\\AdapterFolderPath\r\n \r\n \r\n {0}\r\n \r\n"; + + private readonly string DefaultRunSettings = string.Join(Environment.NewLine, + "", + "", + " ", + " c:\\AdapterFolderPath", + " ", + " ", + " {0}", + " ", + ""); public CollectArgumentProcessorTests() { @@ -50,7 +62,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() var capabilities = new CollectArgumentProcessorCapabilities(); Assert.AreEqual("/Collect", capabilities.CommandName); - Assert.AreEqual("--Collect|/Collect:" + Environment.NewLine + " Enables data collector for the test run. More info here : https://aka.ms/vstest-collect", capabilities.HelpContentResourceName); + var expected = + $"--Collect|/Collect:{Environment.NewLine} Enables data collector for the test run. More info here : https://aka.ms/vstest-collect"; + Assert.AreEqual(expected.NormalizeLineEndings().ShowWhiteSpace(), + capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.CollectArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsFalse(capabilities.IsAction); @@ -105,7 +120,9 @@ public void InitializeShouldThrowExceptionWhenTestSettingsIsEnabled() catch (SettingsException ex) { exceptionThrown = true; - Assert.AreEqual("--Collect|/Collect:\"MyDataCollector\" is not supported if test run is configured using testsettings.", ex.Message); + Assert.AreEqual( + "--Collect|/Collect:\"MyDataCollector\" is not supported if test run is configured using testsettings.", + ex.Message); } Assert.IsTrue(exceptionThrown, "Initialize should throw exception"); @@ -122,26 +139,50 @@ public void InitializeShouldCreateEntryForDataCollectorInRunSettingsIfNotAlready this.executor.Initialize("MyDataCollector"); Assert.IsNotNull(this.settingsProvider.ActiveRunSettings); - Assert.AreEqual("\r\n\r\n \r\n c:\\AdapterFolderPath\r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " c:\\AdapterFolderPath", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeShouldEnableDataCollectorIfDisabledInRunSettings() { - var runsettingsString = string.Format(DefaultRunSettings, ""); + var runsettingsString = string.Format(DefaultRunSettings, + ""); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize("MyDataCollector"); - Assert.AreEqual("\r\n\r\n \r\n c:\\AdapterFolderPath\r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " c:\\AdapterFolderPath", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeShouldNotDisableOtherDataCollectorsIfEnabled() { - var runsettingsString = string.Format(DefaultRunSettings, ""); + var runsettingsString = string.Format(DefaultRunSettings, + ""); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); @@ -149,13 +190,27 @@ public void InitializeShouldNotDisableOtherDataCollectorsIfEnabled() this.executor.Initialize("MyDataCollector"); this.executor.Initialize("MyDataCollector2"); - Assert.AreEqual("\r\n\r\n \r\n c:\\AdapterFolderPath\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " c:\\AdapterFolderPath", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeShouldNotEnableOtherDataCollectorsIfDisabled() { - var runsettingsString = string.Format(DefaultRunSettings, ""); + var runsettingsString = string.Format(DefaultRunSettings, + ""); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); @@ -163,7 +218,20 @@ public void InitializeShouldNotEnableOtherDataCollectorsIfDisabled() this.executor.Initialize("MyDataCollector"); this.executor.Initialize("MyDataCollector2"); - Assert.AreEqual("\r\n\r\n \r\n c:\\AdapterFolderPath\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " c:\\AdapterFolderPath", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] @@ -176,7 +244,19 @@ public void InitializeShouldEnableMultipleCollectorsWhenCalledMoreThanOnce() this.executor.Initialize("MyDataCollector"); this.executor.Initialize("MyDataCollector1"); - Assert.AreEqual("\r\n\r\n \r\n c:\\AdapterFolderPath\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " c:\\AdapterFolderPath", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] @@ -188,7 +268,23 @@ public void InitializeShouldAddOutProcAndInprocCollectorWhenXPlatCodeCoverageIsE this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize("XPlat Code Coverage"); - Assert.AreEqual($"\r\n\r\n \r\n c:\\AdapterFolderPath\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " c:\\AdapterFolderPath", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] @@ -204,7 +300,23 @@ public void UpdageXPlatCodeCoverageCodebaseWithFullPathFromTestAdaptersPaths_Fou executor.Initialize("XPlat Code Coverage"); executor.Execute(); - Assert.AreEqual($"\r\n\r\n \r\n c:\\AdapterFolderPath\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " c:\\AdapterFolderPath", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + $" ", + " ", + " ", + "").ShowWhiteSpace(), this.settingsProvider.ActiveRunSettings.SettingsXml.ShowWhiteSpace()); } [TestMethod] @@ -220,74 +332,237 @@ public void UpdageXPlatCodeCoverageCodebaseWithFullPathFromTestAdaptersPaths_Not executor.Initialize("XPlat Code Coverage"); executor.Execute(); - Assert.AreEqual($"\r\n\r\n \r\n c:\\AdapterFolderPath\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " c:\\AdapterFolderPath", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeXPlatCodeCoverageShouldNotChangeExistingDataCollectors() { - var runsettingsString = "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"; + var runsettingsString = string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + ""); runsettingsString = string.Format(runsettingsString, string.Empty); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize("XPlat Code Coverage"); - Assert.AreEqual($"\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + $" ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeXPlatCodeCoverageShouldNotChangeExistingXPlatDataCollectorSetting() { - var runsettingsString = "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n "; + var runsettingsString = string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " "); runsettingsString = string.Format(runsettingsString, string.Empty); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize("XPlat Code Coverage"); - Assert.AreEqual($"\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + $" ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeXPlatCodeCoverageShouldNotChangeExistingXPlatInProcDataCollectorSetting() { - var runsettingsString = "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"; + var runsettingsString = string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + ""); runsettingsString = string.Format(runsettingsString, string.Empty); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize("XPlat Code Coverage"); - Assert.AreEqual("\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeXPlatCodeCoverageShouldAddXPlatOutProcProcDataCollectorSetting() { - var runsettingsString = $"\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"; + var runsettingsString = string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + $" ", + " ", + " ", + ""); runsettingsString = string.Format(runsettingsString, string.Empty); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize("XPlat Code Coverage"); - Assert.AreEqual($"\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + $" ", + " ", + " ", + " ", + " ", + $" ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeXPlatCodeCoverageShouldAddXPlatInProcProcDataCollectoPropertiesIfNotPresent() { - var runsettingsString = $"\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"; + var runsettingsString = string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + $" ", + " ", + " ", + ""); runsettingsString = string.Format(runsettingsString, string.Empty); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize("XPlat Code Coverage"); - Assert.AreEqual($"\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + $" ", + " ", + " ", + " ", + " ", + $" ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } #endregion } -} +} \ No newline at end of file diff --git a/test/vstest.console.UnitTests/Processors/EnableCodeCoverageArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/EnableCodeCoverageArgumentProcessorTests.cs index 26f174bc74..95737ecd53 100644 --- a/test/vstest.console.UnitTests/Processors/EnableCodeCoverageArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/EnableCodeCoverageArgumentProcessorTests.cs @@ -3,6 +3,7 @@ namespace vstest.console.UnitTests.Processors { + using System; using Microsoft.VisualStudio.TestPlatform.CommandLine; using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors; using Microsoft.VisualStudio.TestPlatform.Common; @@ -16,12 +17,20 @@ public class EnableCodeCoverageArgumentProcessorTests { private TestableRunSettingsProvider settingsProvider; private EnableCodeCoverageArgumentExecutor executor; - private const string DefaultRunSettings = "\r\n\r\n \r\n {0}\r\n \r\n"; + + private readonly string DefaultRunSettings = string.Join(Environment.NewLine, + "", + "", + " ", + " {0}", + " ", + ""); public EnableCodeCoverageArgumentProcessorTests() { this.settingsProvider = new TestableRunSettingsProvider(); - this.executor = new EnableCodeCoverageArgumentExecutor(CommandLineOptions.Instance, this.settingsProvider, new Mock().Object); + this.executor = new EnableCodeCoverageArgumentExecutor(CommandLineOptions.Instance, this.settingsProvider, + new Mock().Object); CollectArgumentExecutor.EnabledDataCollectors.Clear(); } @@ -71,7 +80,8 @@ public void InitializeShouldSetEnableCodeCoverageOfCommandLineOption() this.executor.Initialize(string.Empty); - Assert.IsTrue(CommandLineOptions.Instance.EnableCodeCoverage, "/EnableCoverage should set CommandLineOption.EnableCodeCoverage to true"); + Assert.IsTrue(CommandLineOptions.Instance.EnableCodeCoverage, + "/EnableCoverage should set CommandLineOption.EnableCodeCoverage to true"); } [TestMethod] @@ -85,50 +95,82 @@ public void InitializeShouldCreateEntryForCodeCoverageInRunSettingsIfNotAlreadyP this.executor.Initialize(string.Empty); Assert.IsNotNull(this.settingsProvider.ActiveRunSettings); - var dataCollectorsFriendlyNames = XmlRunSettingsUtilities.GetDataCollectorsFriendlyName(this.settingsProvider.ActiveRunSettings.SettingsXml); - Assert.IsTrue(dataCollectorsFriendlyNames.Contains("Code Coverage"), "Code coverage setting in not available in runsettings"); + var dataCollectorsFriendlyNames = + XmlRunSettingsUtilities.GetDataCollectorsFriendlyName(this.settingsProvider.ActiveRunSettings + .SettingsXml); + Assert.IsTrue(dataCollectorsFriendlyNames.Contains("Code Coverage"), + "Code coverage setting in not available in runsettings"); } [TestMethod] public void InitializeShouldEnableCodeCoverageIfDisabledInRunSettings() { - var runsettingsString = string.Format(DefaultRunSettings, ""); + var runsettingsString = string.Format(DefaultRunSettings, + ""); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize(string.Empty); - Assert.AreEqual("\r\n\r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeShouldNotDisableOtherDataCollectors() { CollectArgumentExecutor.EnabledDataCollectors.Add("mydatacollector1"); - var runsettingsString = string.Format(DefaultRunSettings, ""); + var runsettingsString = string.Format(DefaultRunSettings, + ""); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize(string.Empty); - Assert.AreEqual("\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } [TestMethod] public void InitializeShouldNotEnableOtherDataCollectors() { - var runsettingsString = string.Format(DefaultRunSettings, ""); + var runsettingsString = string.Format(DefaultRunSettings, + ""); var runsettings = new RunSettings(); runsettings.LoadSettingsXml(runsettingsString); this.settingsProvider.SetActiveRunSettings(runsettings); this.executor.Initialize(string.Empty); - Assert.AreEqual("\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n", this.settingsProvider.ActiveRunSettings.SettingsXml); + Assert.AreEqual(string.Join(Environment.NewLine, + "", + "", + " ", + " ", + " ", + " ", + " ", + " ", + ""), this.settingsProvider.ActiveRunSettings.SettingsXml); } #endregion } -} +} \ No newline at end of file diff --git a/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs index 5af480c51b..524a9cb0d4 100644 --- a/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs @@ -19,7 +19,8 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors [TestClass] public class EnvironmentArgumentProcessorTests { - private const string DefaultRunSettings = ""; + private const string DefaultRunSettings = + ""; private TestableRunSettingsProvider settingsProvider; private Mock mockOutput; @@ -65,7 +66,9 @@ public void AppendsEnvironmentVariableToRunSettings() executor.Initialize("VARIABLE=VALUE"); // Assert - var (environmentVariables, inIsolation) = ParseSettingsXML(this.settingsProvider); + var result = ParseSettingsXML(this.settingsProvider); + var environmentVariables = result.variables; + var inIsolation = result.inIsolation; var variables = environmentVariables?.Elements()?.ToArray(); Assert.IsNotNull(environmentVariables, "Environment variable cannot found in RunSettings.xml."); @@ -82,7 +85,9 @@ public void AppendsEnvironmentVariableToRunSettings() public void AppendsMultipleEnvironmentVariablesToRunSettings() { // Arrange - var (executor1, executor2, executor3) = (GetExecutor(), GetExecutor(), GetExecutor()); + var executor1 = GetExecutor(); + var executor2 = GetExecutor(); + var executor3 = GetExecutor(); // Act executor1.Initialize("VARIABLE_ONE=VALUE"); @@ -90,7 +95,9 @@ public void AppendsMultipleEnvironmentVariablesToRunSettings() executor3.Initialize("VARIABLE_THREE=VALUE WITH SPACE;AND SEMICOLON"); // Assert - var (environmentVariables, inIsolation) = ParseSettingsXML(this.settingsProvider); + var result = ParseSettingsXML(this.settingsProvider); + var environmentVariables = result.variables; + var inIsolation = result.inIsolation; var variables = environmentVariables?.Elements()?.ToArray(); Assert.IsNotNull(environmentVariables, "Environment variable cannot found in RunSettings.xml."); @@ -121,7 +128,9 @@ public void InIsolationValueShouldBeOverriden() executor.Initialize("VARIABLE=VALUE"); // Assert - var (environmentVariables, inIsolation) = ParseSettingsXML(this.settingsProvider); + var result = ParseSettingsXML(this.settingsProvider); + var environmentVariables = result.variables; + var inIsolation = result.inIsolation; var variables = environmentVariables?.Elements()?.ToArray(); Assert.IsNotNull(environmentVariables, "Environment variable cannot found in RunSettings.xml."); @@ -138,7 +147,8 @@ public void InIsolationValueShouldBeOverriden() public void ShoudWarnWhenAValueIsOverriden() { // Arrange - this.settingsProvider.UpdateRunSettingsNode("RunConfiguration.EnvironmentVariables.VARIABLE", "Initial value"); + this.settingsProvider.UpdateRunSettingsNode("RunConfiguration.EnvironmentVariables.VARIABLE", + "Initial value"); var warningMessage = String.Format(CommandLineResources.CommandLineWarning, String.Format(CommandLineResources.EnvironmentVariableXIsOverriden, "VARIABLE") ); @@ -157,7 +167,7 @@ public void ShoudWarnWhenAValueIsOverriden() this.mockOutput.VerifyAll(); } - private (XElement variables, XElement inIsolation) ParseSettingsXML(IRunSettingsProvider provider) + private XmlParseResult ParseSettingsXML(IRunSettingsProvider provider) { var document = XDocument.Parse(provider.ActiveRunSettings.SettingsXml); @@ -168,7 +178,7 @@ public void ShoudWarnWhenAValueIsOverriden() var variables = runConfiguration?.Element("EnvironmentVariables"); var inIsolation = runConfiguration?.Element("InIsolation"); - return (variables, inIsolation); + return new XmlParseResult(variables, inIsolation); } private IArgumentExecutor GetExecutor() @@ -179,5 +189,17 @@ private IArgumentExecutor GetExecutor() mockOutput.Object ); } + + private class XmlParseResult + { + public XmlParseResult(XElement variables, XElement inIsolation) + { + this.variables = variables; + this.inIsolation = inIsolation; + } + + internal XElement variables; + internal XElement inIsolation; + } } } diff --git a/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs index cfe5d8eab1..8c00ed0477 100644 --- a/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs @@ -109,7 +109,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() var capabilities = new ListTestsArgumentProcessorCapabilities(); Assert.AreEqual("/ListTests", capabilities.CommandName); Assert.AreEqual("/lt", capabilities.ShortCommandName); - Assert.AreEqual("-lt|--ListTests|/lt|/ListTests:" + Environment.NewLine + " Lists all discovered tests from the given test container.", capabilities.HelpContentResourceName); + var expected = "-lt|--ListTests|/lt|/ListTests:\r\n Lists all discovered tests from the given test container."; + Assert.AreEqual(expected.NormalizeLineEndings().ShowWhiteSpace(), capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.ListTestsArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsTrue(capabilities.IsAction); diff --git a/test/vstest.console.UnitTests/Processors/ParallelArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ParallelArgumentProcessorTests.cs index cfc129e8dc..e6d9147018 100644 --- a/test/vstest.console.UnitTests/Processors/ParallelArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ParallelArgumentProcessorTests.cs @@ -50,7 +50,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() { var capabilities = new ParallelArgumentProcessorCapabilities(); Assert.AreEqual("/Parallel", capabilities.CommandName); - Assert.AreEqual("--Parallel|/Parallel" + Environment.NewLine + " Specifies that the tests be executed in parallel. By default up" + Environment.NewLine + " to all available cores on the machine may be used." + Environment.NewLine + " The number of cores to use may be configured using a settings file.", capabilities.HelpContentResourceName); + var expected = "--Parallel|/Parallel\r\n Specifies that the tests be executed in parallel. By default up\r\n to all available cores on the machine may be used.\r\n The number of cores to use may be configured using a settings file."; + Assert.AreEqual(expected.NormalizeLineEndings().ShowWhiteSpace(), capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.ParallelArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsFalse(capabilities.IsAction); diff --git a/test/vstest.console.UnitTests/Processors/ParentProcessIdArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ParentProcessIdArgumentProcessorTests.cs index 3c87d34c2b..a8bb3f1e7d 100644 --- a/test/vstest.console.UnitTests/Processors/ParentProcessIdArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ParentProcessIdArgumentProcessorTests.cs @@ -39,7 +39,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() { var capabilities = new ParentProcessIdArgumentProcessorCapabilities(); Assert.AreEqual("/ParentProcessId", capabilities.CommandName); - Assert.AreEqual("--ParentProcessId|/ParentProcessId:" + Environment.NewLine + " Process Id of the Parent Process responsible for launching current process.", capabilities.HelpContentResourceName); + var expected = "--ParentProcessId|/ParentProcessId:\r\n Process Id of the Parent Process responsible for launching current process."; + Assert.AreEqual(expected.NormalizeLineEndings().ShowWhiteSpace(), capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.ParentProcessIdArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsFalse(capabilities.IsAction); diff --git a/test/vstest.console.UnitTests/Processors/PlatformArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/PlatformArgumentProcessorTests.cs index 902296ee42..cbef5b5667 100644 --- a/test/vstest.console.UnitTests/Processors/PlatformArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/PlatformArgumentProcessorTests.cs @@ -50,7 +50,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() { var capabilities = new PlatformArgumentProcessorCapabilities(); Assert.AreEqual("/Platform", capabilities.CommandName); - Assert.AreEqual("--Platform|/Platform:" + Environment.NewLine + " Target platform architecture to be used for test execution. " + Environment.NewLine + " Valid values are x86, x64 and ARM.", capabilities.HelpContentResourceName); + var expected = "--Platform|/Platform:\r\n Target platform architecture to be used for test execution. \r\n Valid values are x86, x64 and ARM."; + Assert.AreEqual(expected: expected.NormalizeLineEndings().ShowWhiteSpace(), capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.PlatformArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsFalse(capabilities.IsAction); diff --git a/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs index d7e1d562d6..1982257d91 100644 --- a/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.Text.RegularExpressions; + namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors { using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -50,7 +52,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() { var capabilities = new ResultsDirectoryArgumentProcessorCapabilities(); Assert.AreEqual("/ResultsDirectory", capabilities.CommandName); - Assert.AreEqual("--ResultsDirectory|/ResultsDirectory" + Environment.NewLine + " Test results directory will be created in specified path if not exists." + Environment.NewLine + " Example /ResultsDirectory:", capabilities.HelpContentResourceName); + var expected = "--ResultsDirectory|/ResultsDirectory\r\n Test results directory will be created in specified path if not exists.\r\n Example /ResultsDirectory:"; + Assert.AreEqual(expected.NormalizeLineEndings().ShowWhiteSpace(), capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.ResultsDirectoryArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsFalse(capabilities.IsAction); @@ -84,41 +87,22 @@ public void InitializeShouldThrowIfArgumentIsAWhiteSpace() } [TestMethod] - public void InitializeShouldThrowIfGivenPathisIllegal() + public void InitializeShouldThrowIfGivenPathIsIllegal() { - var folder = @"c:\som>\illegal\path\"; - string message; - - message = string.Format( - @"The path '{0}' specified in the 'ResultsDirectory' is invalid. Error: {1}", - folder, - "The filename, directory name, or volume label syntax is incorrect : \'c:\\som>\\illegal\\path\\\'"); - -#if NETFRAMEWORK - message = string.Format( - @"The path '{0}' specified in the 'ResultsDirectory' is invalid. Error: {1}", - folder, - "Illegal characters in path."); -#endif - this.InitializeExceptionTestTemplate(folder, message); - } - - [TestMethod] - public void InitializeShouldThrowIfPathIsNotSupported() - { - - var folder = @"c:\path\to\in:valid"; - string message; - message = string.Format( - @"The path '{0}' specified in the 'ResultsDirectory' is invalid. Error: {1}", - folder, - "The directory name is invalid : \'c:\\path\\to\\in:valid\'"); -#if NETFRAMEWORK - message = string.Format( - @"The path '{0}' specified in the 'ResultsDirectory' is invalid. Error: {1}", - folder, - "The given path's format is not supported."); -#endif + // the internal code uses IsPathRooted which does not consider this rooted on Linux + // so we need to convert the path, and use char that is invalid on the current platform + var invalidChar = Path.GetInvalidPathChars()[0]; + + var folder = TranslatePath($@"c:\som{invalidChar}\illegal\path\"); + // The error varies based on the runtime and OS, just checking that we detect + // incorrect path should be enough and not so flaky + // you might get + // - The filename, directory name, or volume label syntax is incorrect + // - Illegal characters in path. + // - etc. + + var message = $"The path '{folder}' specified in the 'ResultsDirectory' is invalid. Error:"; + this.InitializeExceptionTestTemplate(folder, message); } @@ -133,17 +117,17 @@ private void InitializeExceptionTestTemplate(string folder, string message) catch (Exception ex) { isExceptionThrown = true; - Assert.IsTrue(ex is CommandLineException); - Assert.AreEqual(message, ex.Message); + Assert.IsTrue(ex is CommandLineException, "ex is CommandLineException"); + StringAssert.StartsWith( ex.Message, message); } - Assert.IsTrue(isExceptionThrown); + Assert.IsTrue(isExceptionThrown, "isExceptionThrown"); } [TestMethod] public void InitializeShouldSetCommandLineOptionsAndRunSettingsForRelativePathValue() { - var relativePath = @".\relative\path"; + var relativePath = TranslatePath(@".\relative\path"); var absolutePath = Path.GetFullPath(relativePath); this.executor.Initialize(relativePath); Assert.AreEqual(absolutePath, CommandLineOptions.Instance.ResultsDirectory); @@ -153,7 +137,7 @@ public void InitializeShouldSetCommandLineOptionsAndRunSettingsForRelativePathVa [TestMethod] public void InitializeShouldSetCommandLineOptionsAndRunSettingsForAbsolutePathValue() { - var absolutePath = @"c:\random\someone\testresults"; + var absolutePath = TranslatePath(@"c:\random\someone\testresults"); this.executor.Initialize(absolutePath); Assert.AreEqual(absolutePath, CommandLineOptions.Instance.ResultsDirectory); Assert.AreEqual(absolutePath, this.runSettingsProvider.QueryRunSettingsNode(ResultsDirectoryArgumentExecutor.RunSettingsPath)); @@ -170,5 +154,16 @@ public void ExecuteShouldReturnSuccess() } #endregion + + private string TranslatePath(string path) + { + // RuntimeInformation has conflict when used + if (Environment.OSVersion.Platform.ToString().StartsWith("Win")) + return path; + + var prefix = Path.GetTempPath(); + + return Regex.Replace(path.Replace("\\", "/"), @"(\w)\:/", $@"{prefix}$1/"); + } } } diff --git a/test/vstest.console.UnitTests/Processors/RunSettingsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSettingsArgumentProcessorTests.cs index ccfaded2e8..5c3cebe4f4 100644 --- a/test/vstest.console.UnitTests/Processors/RunSettingsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSettingsArgumentProcessorTests.cs @@ -60,7 +60,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() { var capabilities = new RunSettingsArgumentProcessorCapabilities(); Assert.AreEqual("/Settings", capabilities.CommandName); - Assert.AreEqual("--Settings|/Settings:" + Environment.NewLine + " Settings to use when running tests.", capabilities.HelpContentResourceName); + var expected = "--Settings|/Settings:\r\n Settings to use when running tests."; + Assert.AreEqual(expected.NormalizeLineEndings().ShowWhiteSpace(), capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.RunSettingsArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsFalse(capabilities.IsAction); @@ -239,22 +240,22 @@ public void InitializeShouldSetActiveRunSettingsForTestSettingsFiles() // Assert. Assert.IsNotNull(this.settingsProvider.ActiveRunSettings); - var expected = - $"\r\n" + - $"\r\n" + - $" \r\n" + - $" {Constants.DefaultResultsDirectory}\r\n" + - $" {Constants.DefaultPlatform}\r\n" + - $" {Framework.DefaultFramework.Name}\r\n" + - $" \r\n" + - $" \r\n" + - $" C:\\temp\\r.testsettings\r\n" + - $" true\r\n" + - $" \r\n" + - $" \r\n" + - $" \r\n" + - $" \r\n" + - $""; + var expected = string.Join(Environment.NewLine, + $"", + $"", + $" ", + $" {Constants.DefaultResultsDirectory}", + $" {Constants.DefaultPlatform}", + $" {Framework.DefaultFramework.Name}", + $" ", + $" ", + $" C:\\temp\\r.testsettings", + $" true", + $" ", + $" ", + $" ", + $" ", + $""); StringAssert.Contains(this.settingsProvider.ActiveRunSettings.SettingsXml, expected); } diff --git a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs index 206825c608..9f3c7792e5 100644 --- a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs @@ -95,7 +95,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() { RunSpecificTestsArgumentProcessorCapabilities capabilities = new RunSpecificTestsArgumentProcessorCapabilities(); Assert.AreEqual("/Tests", capabilities.CommandName); - StringAssert.Contains(capabilities.HelpContentResourceName, "/Tests:" + Environment.NewLine + " Run tests with names that match the provided values."); + StringAssert.Contains(capabilities.HelpContentResourceName.NormalizeLineEndings(), + "/Tests:\r\n Run tests with names that match the provided values.".NormalizeLineEndings()); Assert.AreEqual(HelpContentPriority.RunSpecificTestsArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsTrue(capabilities.IsAction); diff --git a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs index d3b3814117..f838cd183f 100644 --- a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs @@ -90,7 +90,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() { RunTestsArgumentProcessorCapabilities capabilities = new RunTestsArgumentProcessorCapabilities(); Assert.AreEqual("/RunTests", capabilities.CommandName); - Assert.AreEqual("[TestFileNames]" + Environment.NewLine + " Run tests from the specified files or wild card pattern. Separate multiple test file names or pattern" + Environment.NewLine + " by spaces. Set console logger verbosity to detailed to view matched test files." + Environment.NewLine + " Examples: mytestproject.dll" + Environment.NewLine + " mytestproject.dll myothertestproject.exe" + Environment.NewLine + @" testproject*.dll my*project.dll", capabilities.HelpContentResourceName); + var expected = "[TestFileNames]\r\n Run tests from the specified files or wild card pattern. Separate multiple test file names or pattern\r\n by spaces. Set console logger verbosity to detailed to view matched test files.\r\n Examples: mytestproject.dll\r\n mytestproject.dll myothertestproject.exe\r\n testproject*.dll my*project.dll"; + Assert.AreEqual(expected.NormalizeLineEndings().ShowWhiteSpace(), capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.RunTestsArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsTrue(capabilities.IsAction); diff --git a/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs index dc1dd5812a..7069c4a4b4 100644 --- a/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs @@ -59,7 +59,8 @@ public void CapabilitiesShouldReturnAppropriateProperties() { var capabilities = new TestAdapterPathArgumentProcessorCapabilities(); Assert.AreEqual("/TestAdapterPath", capabilities.CommandName); - Assert.AreEqual("--TestAdapterPath|/TestAdapterPath" + Environment.NewLine + " This makes vstest.console.exe process use custom test adapters" + Environment.NewLine + " from a given path (if any) in the test run. " + Environment.NewLine + " Example /TestAdapterPath:", capabilities.HelpContentResourceName); + var expected = "--TestAdapterPath|/TestAdapterPath\r\n This makes vstest.console.exe process use custom test adapters\r\n from a given path (if any) in the test run. \r\n Example /TestAdapterPath:"; + Assert.AreEqual(expected: expected.NormalizeLineEndings().ShowWhiteSpace(), capabilities.HelpContentResourceName.NormalizeLineEndings().ShowWhiteSpace()); Assert.AreEqual(HelpContentPriority.TestAdapterPathArgumentProcessorHelpPriority, capabilities.HelpPriority); Assert.IsFalse(capabilities.IsAction); @@ -173,6 +174,7 @@ public void InitializeShouldUpdateTestAdapterPathInRunSettings() } [TestMethod] + [TestCategory("Windows")] public void InitializeShouldMergeTestAdapterPathsInRunSettings() { var runSettingsXml = "d:\\users;f:\\users"; @@ -191,6 +193,7 @@ public void InitializeShouldMergeTestAdapterPathsInRunSettings() } [TestMethod] + [TestCategory("Windows")] public void InitializeShouldMergeTestAdapterPathsInRunSettingsIgnoringDuplicatePaths() { var runSettingsXml = "d:\\users;c:\\users"; @@ -209,6 +212,7 @@ public void InitializeShouldMergeTestAdapterPathsInRunSettingsIgnoringDuplicateP } [TestMethod] + [TestCategory("Windows")] public void InitializeShouldMergeMultipleTestAdapterPathsWithPathsInRunSettings() { var runSettingsXml = "d:\\users;f:\\users"; @@ -227,6 +231,7 @@ public void InitializeShouldMergeMultipleTestAdapterPathsWithPathsInRunSettings( } [TestMethod] + [TestCategory("Windows")] public void InitializeShouldHonorEnvironmentVariablesInTestAdapterPaths() { var runSettingsXml = "%temp%\\adapters1"; @@ -247,6 +252,7 @@ public void InitializeShouldHonorEnvironmentVariablesInTestAdapterPaths() } [TestMethod] + [TestCategory("Windows")] public void InitializeShouldAddRightAdapterPathInErrorMessage() { var runSettingsXml = "d:\\users"; @@ -281,6 +287,7 @@ public void InitializeShouldAddRightAdapterPathInErrorMessage() } [TestMethod] + [TestCategory("Windows")] public void InitializeShouldTrimTrailingAndLeadingDoubleQuotes() { var runSettingsXml = "d:\\users"; diff --git a/test/vstest.console.UnitTests/StringExtensions.cs b/test/vstest.console.UnitTests/StringExtensions.cs new file mode 100644 index 0000000000..a9b135a1aa --- /dev/null +++ b/test/vstest.console.UnitTests/StringExtensions.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests +{ + using System; + + public static class StringExtensions + { + /// + /// Replace all \r\n with \n to get Unix line endings to make strings easy to compare while still + /// keeping the formatting in mind. + /// + /// + public static string NormalizeLineEndings(this string text) + { + return text.Replace("\r\n", "\n"); + } + + /// + /// Replace whitespace with printable characters (and still keep \r newlines for easy readability) + /// + /// + public static string ShowWhiteSpace(this string text) + { + // use mongolian vowel separator as placeholder for the newline that we add for formatting + var placeholder = "\u180E"; + if (text.Contains(placeholder)) + throw new InvalidOperationException( + "The text contains mongolian vowel separator character that we use as a placeholder."); + + var whiteSpaced = text + .Replace("\r\n", "\\r\\n\u180E") + .Replace("\r", "\\r") + .Replace("\n", "\\n\u180E") + .Replace("\t", "\\t") + .Replace(" ", "␣") + .Replace("\u180E", "\n"); + + // prepend one newline to get better output from assertion where both expected + // and actual output start on the same position + return "\n" + whiteSpaced; + } + } +} \ No newline at end of file diff --git a/test/vstest.console.UnitTests/vstest.console.UnitTests.csproj b/test/vstest.console.UnitTests/vstest.console.UnitTests.csproj index 2897774e9a..8fb0f65be0 100644 --- a/test/vstest.console.UnitTests/vstest.console.UnitTests.csproj +++ b/test/vstest.console.UnitTests/vstest.console.UnitTests.csproj @@ -3,6 +3,7 @@ ..\..\ true + true @@ -19,9 +20,6 @@ true - - -