Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run multiple target frameworks and architectures in single vstest.console #3412

Merged
merged 142 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
f70b70b
Add test
nohwnd Feb 22, 2022
91c2628
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Feb 22, 2022
a1c9028
Passthru options. Discover request needs to fix settings on criteria …
nohwnd Feb 23, 2022
409cca3
Discovery partially works, I don't update the testsettings in the req…
nohwnd Feb 23, 2022
8e5a289
Add tests for run and discovery with different TFMs.
nohwnd Feb 24, 2022
8ce64ae
First test rewrite.
nohwnd Feb 24, 2022
5d2f4ee
test sessions start
nohwnd Feb 24, 2022
8ec7a91
Manually test console mode a little bit
nohwnd Feb 25, 2022
21eee17
Add nested types and split up
nohwnd Feb 25, 2022
6549db9
Test sessions, and rework a bit
nohwnd Mar 1, 2022
3ca787d
Fix programmer tests
nohwnd Mar 1, 2022
2a85b51
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 1, 2022
14e66d8
Skip source validation and enable checks
nohwnd Mar 1, 2022
a8f5da8
Fix settings check in test sessions, and remove rest of review points
nohwnd Mar 1, 2022
dbfdcd3
Fixing tests
nohwnd Mar 2, 2022
a487325
Fix some unit tests
nohwnd Mar 2, 2022
88ae4ad
Unit tests fixed
nohwnd Mar 2, 2022
d7c059c
Build
nohwnd Mar 2, 2022
4d8054d
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 2, 2022
9e1f93a
Apply suggestions from code review
nohwnd Mar 3, 2022
1d35dc5
Update src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/SourceDet…
nohwnd Mar 3, 2022
66283a0
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 3, 2022
dfb2e81
Fix acceptance tests.
nohwnd Mar 4, 2022
aff2f4a
Apply suggestions from code review
nohwnd Mar 4, 2022
83a9fc6
Remove more workspace
nohwnd Mar 4, 2022
07e4782
Merge branch 'fix-acceptance' of https://github.com/nohwnd/vstest int…
nohwnd Mar 4, 2022
7536588
Revert non-optmize on Release
nohwnd Mar 4, 2022
a94b1bd
More fixes
nohwnd Mar 4, 2022
ef668f0
Update test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs
nohwnd Mar 4, 2022
4fb3b26
Merge branch 'main' into fix-acceptance
nohwnd Mar 4, 2022
8b04531
Fix unit test
nohwnd Mar 4, 2022
e57fe1d
Missing null operator
nohwnd Mar 4, 2022
98fa6b9
Revert incorrect rename
nohwnd Mar 4, 2022
6342ee4
Fix review remarks
nohwnd Mar 4, 2022
4f95d81
Build failures
nohwnd Mar 4, 2022
0f53078
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 4, 2022
b62a26d
Upgrade
nohwnd Mar 4, 2022
c7de6ad
Merge branch 'fix-acceptance' into net6-tests
nohwnd Mar 4, 2022
f15ade9
Upgrade tests
nohwnd Mar 4, 2022
115b842
Merge branch 'main' into net6-tests
nohwnd Mar 4, 2022
100b4dd
Skip web tests locally
nohwnd Mar 4, 2022
cdaf3d0
Apply suggestions from code review
nohwnd Mar 4, 2022
390d80b
Skip in non-ci
nohwnd Mar 4, 2022
543c21c
Change order of tests to run from fastest
nohwnd Mar 4, 2022
76021d2
Newer approach to reference assemblies on MacOS and Linux
nohwnd Mar 7, 2022
4a79dc0
Merge branch 'newer-reference-assemblies' into net6-tests
nohwnd Mar 7, 2022
de7aefc
Revert "Change order of tests to run from fastest"
nohwnd Mar 7, 2022
1bddbc8
Acceptance for net48
nohwnd Mar 7, 2022
c4e7ff1
Fix filter
nohwnd Mar 7, 2022
bbd4473
Apply suggestions from code review
nohwnd Mar 7, 2022
7c6d946
Update scripts/build/TestPlatform.Settings.targets
nohwnd Mar 7, 2022
f38616a
Remove taking target framework and runtime from env variables because…
nohwnd Mar 7, 2022
c9dbf4e
Matrix for mstest wip
nohwnd Mar 9, 2022
79117c9
Merge branch 'main' into test-matrix
nohwnd Mar 9, 2022
ecdb18e
MSTest adapter tests
nohwnd Mar 10, 2022
a65c00a
Add vstest console data source, even though it is names translation l…
nohwnd Mar 10, 2022
0fc39cf
Second test
nohwnd Mar 11, 2022
3b14bb4
Merge branch 'main' into test-matrix
nohwnd Mar 11, 2022
aaecf7f
Remove unused field
nohwnd Mar 11, 2022
82cb607
Translation layer x vstest.console
nohwnd Mar 11, 2022
07cdf1c
Fixup console run
nohwnd Mar 14, 2022
1b0202a
Runs tests from the big data source, but test sdk is not used.
nohwnd Mar 14, 2022
d556525
Compose path to testhost + adapter.
nohwnd Mar 14, 2022
d243b59
One big unified data source. Still no version filtering.
nohwnd Mar 15, 2022
1d22cd9
Remove quote path trimming.
nohwnd Mar 16, 2022
82ad320
Some tests run.
nohwnd Mar 16, 2022
5216498
More fun with sources.
nohwnd Mar 16, 2022
0f087c0
Tests tests.
nohwnd Mar 17, 2022
63e6275
Merge branch 'main' into test-matrix
nohwnd Mar 21, 2022
1a45042
merge
nohwnd Mar 21, 2022
6e84158
Revert unnecessary renames
nohwnd Mar 21, 2022
2b3e039
Ignore strong naming in tests
nohwnd Mar 21, 2022
5987391
Add tags
nohwnd Mar 21, 2022
0e4ce5a
Fix console path
nohwnd Mar 21, 2022
969c2b3
fix
nohwnd Mar 22, 2022
8423de3
merge main
nohwnd Mar 22, 2022
9894fa3
CI cleanup always
nohwnd Mar 22, 2022
5af7437
Print free disk space
nohwnd Mar 23, 2022
81c0b1b
Whitespace and so on
nohwnd Mar 23, 2022
eff69de
Missing temp dir
nohwnd Mar 23, 2022
874f1c2
Merge branch 'main' into test-matrix
nohwnd Mar 23, 2022
5f3f5c2
Fix env variables
nohwnd Mar 23, 2022
a1a461c
Fixes I feel like I did before
nohwnd Mar 23, 2022
5a19d19
Touch
nohwnd Mar 23, 2022
df6a0f2
Merged
nohwnd Mar 23, 2022
0075b0b
Remove comment, and revert back to using TempDirectory
nohwnd Mar 24, 2022
85085dc
Fix quoting
nohwnd Mar 24, 2022
efc810f
Use Nuget.Versioning rather than semver, and revert strong name warni…
nohwnd Mar 24, 2022
02c7d41
Fix tests
nohwnd Mar 28, 2022
6bb4103
Merge branch 'test-matrix' into multi-tfm-run-in-vstestconsole
nohwnd Mar 28, 2022
57be8db
Fix test
nohwnd Mar 28, 2022
ab3093f
Fix
nohwnd Mar 28, 2022
b1e02f5
Fix
nohwnd Mar 28, 2022
3e637fc
Merge branch 'test-matrix' of https://github.com/nohwnd/vstest into t…
nohwnd Mar 28, 2022
a828bbc
Merge branch 'test-matrix' into multi-tfm-run-in-vstestconsole
nohwnd Mar 28, 2022
d33a3f2
Fix build
nohwnd Mar 28, 2022
2ac14cb
Free space
nohwnd Mar 28, 2022
020abf0
Free space
nohwnd Mar 28, 2022
55e8714
Add results directory to blame
nohwnd Mar 28, 2022
ebb15a1
Fix
nohwnd Mar 28, 2022
8c0cc0c
Add tools and fix gitingore
nohwnd Mar 29, 2022
23b5f66
Fix build
nohwnd Mar 28, 2022
1d9003c
Add tools and fix gitingore
nohwnd Mar 29, 2022
a8e8476
Merge branch 'main' into test-matrix
nohwnd Mar 29, 2022
25c5802
Make Cancel Discovery faster and more reliable
nohwnd Mar 29, 2022
0e063a4
Merge branch 'discovery-cancel-faster-better-more-reliable' into test…
nohwnd Mar 29, 2022
4dd10bc
Add fluent assertions
nohwnd Mar 29, 2022
fd235c1
Cancellation
nohwnd Mar 29, 2022
68c4e4a
Merge
nohwnd Mar 29, 2022
70f4e81
Merge branch 'test-matrix' into multi-tfm-run-in-vstestconsole
nohwnd Mar 29, 2022
b346a3e
Renames and fixes
nohwnd Mar 29, 2022
5e81462
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 29, 2022
a24d1b1
Add debugger info
nohwnd May 12, 2022
6e0ef0a
Merged
nohwnd May 12, 2022
6933548
Half merged but is missing some test fixes
nohwnd May 12, 2022
65e1e0f
Programmer tests build and run, I think I left some not passing befor…
nohwnd May 12, 2022
0b25dff
Try with test sessions
nohwnd May 12, 2022
0f1e8bd
Fix programmer tests and add DISABLE_MULTI_TFM
nohwnd May 12, 2022
f7b8e94
Re-enable warnings for multtfm when there are settings forcing framew…
nohwnd May 12, 2022
095345d
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd May 13, 2022
08d86c4
Smaller PR comments addressed
nohwnd May 13, 2022
3c22472
Rewrite ParallelOperationManagerTests because that class fully changed
nohwnd May 13, 2022
d624583
Fix build warnings
nohwnd May 13, 2022
da6150c
Remove test checking that we set custom launcher on default runtime p…
nohwnd May 13, 2022
f997480
Fix NOMERGE unit tests
nohwnd May 13, 2022
8734b3a
Fix runsettings tests
nohwnd May 13, 2022
2980a29
More unit tests
nohwnd May 13, 2022
94bc0f1
Fix more unit tests
nohwnd May 13, 2022
2f6c67a
Fix unit test
nohwnd May 13, 2022
08506a8
Update resources
nohwnd May 16, 2022
750c8bb
Fix collection modified exception
nohwnd May 16, 2022
fe4218e
Don't return true where you should not
nohwnd May 16, 2022
a6dbcf2
Fix assignment
nohwnd May 17, 2022
dbb04f6
Fix tests
nohwnd May 17, 2022
d6d47a5
up versions for matrix
nohwnd May 17, 2022
902e435
More PR feedbacks
nohwnd May 17, 2022
5e2f9b0
up internal version and remove debug attribute
nohwnd May 17, 2022
287b4e6
yah for the extra parent
nohwnd May 17, 2022
7dcf780
Fix testhost startup performance and choosing x86 for mixed runs.
nohwnd May 18, 2022
da0cbdf
Clean up HandlePartialRunComplete, and fix unit tests
nohwnd May 19, 2022
6e49ebe
Fix acceptance tests
nohwnd May 19, 2022
6f5bedb
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd May 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,23 @@ if ($env:PATH -notlike "*$attachVsPath") {
$env:PATH = "$attachVsPath;$env:PATH"
}

# VsixUtil gets regularly eaten by antivirus or something. Remove the package dir if it gets broken
# so nuget restores it correctly.
$vsSdkBuildToolsVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.VSSdkBuildToolsVersion
$vsixUtilDir = "$env:TP_ROOT_DIR\packages\microsoft.vssdk.buildtools"
if ((Test-Path $vsixUtilDir) -and -not (Test-Path "$vsixUtilDir\$vsSdkBuildToolsVersion\tools\vssdk\bin\VsixUtil.exe"))
{
Remove-Item -Recurse -Force $vsixUtilDir
}

# Procdump gets regularly eaten by antivirus or something. Remove the package dir if it gets broken
# so nuget restores it correctly.
$procdumpDir = "$env:TP_ROOT_DIR\packages\procdump"
if ((Test-Path $procdumpDir) -and 2 -ne @(Get-Item "$procdumpDir\0.0.1\bin").Length)
{
Remove-Item -Recurse -Force $procdumpDir
}

function Invoke-Build
{
$timer = Start-Timer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,10 @@ public void InitializeShouldSubscribeToDataCollectionEvents()
{
var testableDataCollectionEvents = new TestableDataCollectionEvents();
_eventLogDataCollector.Initialize(null, testableDataCollectionEvents, _mockDataCollectionSink, _mockDataCollectionLogger.Object, _dataCollectionEnvironmentContext);
Assert.AreEqual(1, testableDataCollectionEvents.GetTestHostLaunchedInvocationList().Length);
Assert.AreEqual(1, testableDataCollectionEvents.GetTestCaseStartInvocationList().Length);
Assert.AreEqual(1, testableDataCollectionEvents.GetTestCaseEndInvocationList().Length);
Assert.AreEqual(1, testableDataCollectionEvents.GetTestSessionEndInvocationList().Length);
Assert.AreEqual(1, testableDataCollectionEvents.GetTestSessionStartInvocationList().Length);
Assert.AreEqual(1, testableDataCollectionEvents.GetTestCaseStartInvocationList()?.Length, "GetTestCaseStartInvocationList");
Assert.AreEqual(1, testableDataCollectionEvents.GetTestCaseEndInvocationList()?.Length, "GetTestCaseEndInvocationList");
Assert.AreEqual(1, testableDataCollectionEvents.GetTestSessionEndInvocationList()?.Length, "GetTestSessionEndInvocationList");
Assert.AreEqual(1, testableDataCollectionEvents.GetTestSessionStartInvocationList()?.Length, "GetTestSessionStartInvocationList");
}

[TestMethod]
Expand Down
9 changes: 4 additions & 5 deletions test/Microsoft.TestPlatform.AcceptanceTests/AppDomainTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@ public void RunTestExecutionWithDisableAppDomain(RunnerInfo runnerInfo)
{
SetTestEnvironment(_testEnvironment, runnerInfo);

using var tempDir = new TempDirectory();
var testAppDomainDetailFileName = Path.Combine(tempDir.Path, "appdomain_test.txt");
var dataCollectorAppDomainDetailFileName = Path.Combine(tempDir.Path, "appdomain_datacollector.txt");
var testAppDomainDetailFileName = Path.Combine(TempDirectory.Path, "appdomain_test.txt");
var dataCollectorAppDomainDetailFileName = Path.Combine(TempDirectory.Path, "appdomain_datacollector.txt");

// Delete test output files if already exist
File.Delete(testAppDomainDetailFileName);
File.Delete(dataCollectorAppDomainDetailFileName);

var runsettingsFilePath = GetInProcDataCollectionRunsettingsFile(true, tempDir);
var runsettingsFilePath = GetInProcDataCollectionRunsettingsFile(true, TempDirectory);
var arguments = PrepareArguments(
GetSampleTestAssembly(),
GetTestAdapterPath(),
runsettingsFilePath,
FrameworkArgValue,
runnerInfo.InIsolationValue,
tempDir.Path);
TempDirectory.Path);

// Sets the environment variables used by the test project and test data collector.
var env = new Dictionary<string, string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// 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.TestPlatform.TestUtilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

#nullable disable
Expand Down Expand Up @@ -41,8 +40,7 @@ public void PassingInvalidArgumentsToVsTestConsoleShouldNotPrintHelpMessage(Runn
{
SetTestEnvironment(_testEnvironment, runnerInfo);

using var tempDir = new TempDirectory();
var arguments = PrepareArguments(GetSampleTestAssembly(), GetTestAdapterPath(), string.Empty, FrameworkArgValue, resultsDirectory: tempDir.Path);
var arguments = PrepareArguments(GetSampleTestAssembly(), GetTestAdapterPath(), string.Empty, FrameworkArgValue, resultsDirectory: TempDirectory.Path);
arguments = string.Concat(arguments, " /badArgument");

InvokeVsTest(arguments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;

using Microsoft.TestPlatform.TestUtilities;
Expand All @@ -23,6 +24,19 @@ public class BlameDataCollectorTests : AcceptanceTestBase
{
public const string NETCOREANDFX = "net452;net472;netcoreapp3.1";
public const string NET50 = "net5.0";
private readonly string _procDumpPath;

public BlameDataCollectorTests()
{
_procDumpPath = Path.Combine(_testEnvironment.PackageDirectory, @"procdump\0.0.1\bin");
var procDumpExePath = Path.Combine(_procDumpPath, "procdump.exe");
if (!File.Exists(procDumpExePath))
{
throw new InvalidOperationException($"Procdump path {procDumpExePath} does not exist. "
+ "It is possible that antivirus deleted it from your nuget cache. "
+ "Delete the whole procdump folder in your nuget cache, and run build, or restore");
}
}

[TestMethod]
// netcoreapp2.1 dump is not supported on Linux
Expand All @@ -31,15 +45,14 @@ public class BlameDataCollectorTests : AcceptanceTestBase
[NetCoreTargetFrameworkDataSource]
public void BlameDataCollectorShouldGiveCorrectTestCaseName(RunnerInfo runnerInfo)
{
using var tempDir = new TempDirectory();
SetTestEnvironment(_testEnvironment, runnerInfo);
var assemblyPaths = GetAssetFullPath("BlameUnitTestProject.dll");
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue);
arguments = string.Concat(arguments, $" /Blame");
arguments = string.Concat(arguments, $" /ResultsDirectory:{tempDir.Path}");
arguments = string.Concat(arguments, $" /ResultsDirectory:{TempDirectory.Path}");
InvokeVsTest(arguments);

VaildateOutput(tempDir, "BlameUnitTestProject.UnitTest1.TestMethod2");
VaildateOutput(TempDirectory, "BlameUnitTestProject.UnitTest1.TestMethod2");
}

[TestMethod]
Expand All @@ -49,23 +62,22 @@ public void BlameDataCollectorShouldGiveCorrectTestCaseName(RunnerInfo runnerInf
[NetCoreTargetFrameworkDataSource]
public void BlameDataCollectorShouldOutputDumpFile(RunnerInfo runnerInfo)
{
using var tempDir = new TempDirectory();

SetTestEnvironment(_testEnvironment, runnerInfo);
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject3.dll").Trim('\"');
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue);
arguments = string.Concat(arguments, $" /Blame:CollectDump");
arguments = string.Concat(arguments, $" /ResultsDirectory:{tempDir.Path}");
arguments = string.Concat(arguments, $" /ResultsDirectory:{TempDirectory.Path}");
arguments = string.Concat(arguments, " /testcasefilter:ExitWithStackoverFlow");

var env = new Dictionary<string, string>
{
["PROCDUMP_PATH"] = Path.Combine(_testEnvironment.PackageDirectory, @"procdump\0.0.1\bin"),
["PROCDUMP_PATH"] = _procDumpPath,
};

InvokeVsTest(arguments, env);

VaildateOutput(tempDir, "SampleUnitTestProject3.UnitTest1.ExitWithStackoverFlow", validateDumpFile: true);
VaildateOutput(TempDirectory, "SampleUnitTestProject3.UnitTest1.ExitWithStackoverFlow", validateDumpFile: true);
}

[TestMethod]
Expand All @@ -75,18 +87,17 @@ public void BlameDataCollectorShouldOutputDumpFile(RunnerInfo runnerInfo)
[NetCoreTargetFrameworkDataSource]
public void BlameDataCollectorShouldNotOutputDumpFileWhenNoCrashOccurs(RunnerInfo runnerInfo)
{
using var tempDir = new TempDirectory();

SetTestEnvironment(_testEnvironment, runnerInfo);
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject.dll").Trim('\"');
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue);
arguments = string.Concat(arguments, $" /Blame:CollectDump");
arguments = string.Concat(arguments, $" /ResultsDirectory:{tempDir.Path}");
arguments = string.Concat(arguments, $" /ResultsDirectory:{TempDirectory.Path}");
arguments = string.Concat(arguments, " /testcasefilter:PassingTest");

var env = new Dictionary<string, string>
{
["PROCDUMP_PATH"] = Path.Combine(_testEnvironment.PackageDirectory, @"procdump\0.0.1\bin"),
["PROCDUMP_PATH"] = _procDumpPath
};

InvokeVsTest(arguments, env);
Expand All @@ -101,23 +112,22 @@ public void BlameDataCollectorShouldNotOutputDumpFileWhenNoCrashOccurs(RunnerInf
[NetCoreTargetFrameworkDataSource]
public void BlameDataCollectorShouldOutputDumpFileWhenNoCrashOccursButCollectAlwaysIsEnabled(RunnerInfo runnerInfo)
{
using var tempDir = new TempDirectory();

SetTestEnvironment(_testEnvironment, runnerInfo);
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject.dll").Trim('\"');
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue);
arguments = string.Concat(arguments, $" /Blame:CollectDump;CollectAlways=True");
arguments = string.Concat(arguments, $" /ResultsDirectory:{tempDir.Path}");
arguments = string.Concat(arguments, $" /ResultsDirectory:{TempDirectory.Path}");
arguments = string.Concat(arguments, " /testcasefilter:PassingTest");

var env = new Dictionary<string, string>
{
["PROCDUMP_PATH"] = Path.Combine(_testEnvironment.PackageDirectory, @"procdump\0.0.1\bin"),
["PROCDUMP_PATH"] = _procDumpPath
};

InvokeVsTest(arguments, env);

Assert.IsTrue(StdOut.Contains(".dmp"), "it should collect dump, even if nothing crashed");
StringAssert.Matches(StdOut, new Regex("\\.dmp"), "it should collect dump, even if nothing crashed");
}

[TestMethod]
Expand All @@ -133,7 +143,7 @@ public void HangDumpOnTimeout(RunnerInfo runnerInfo)

var env = new Dictionary<string, string>
{
["PROCDUMP_PATH"] = Path.Combine(_testEnvironment.PackageDirectory, @"procdump\0.0.1\bin"),
["PROCDUMP_PATH"] = _procDumpPath
};

InvokeVsTest(arguments, env);
Expand All @@ -156,7 +166,7 @@ public void CrashDumpWhenThereIsNoTimeout(RunnerInfo runnerInfo)

var env = new Dictionary<string, string>
{
["PROCDUMP_PATH"] = Path.Combine(_testEnvironment.PackageDirectory, @"procdump\0.0.1\bin"),
["PROCDUMP_PATH"] = _procDumpPath
};

InvokeVsTest(arguments, env);
Expand All @@ -179,7 +189,7 @@ public void CrashDumpOnExit(RunnerInfo runnerInfo)

var env = new Dictionary<string, string>
{
["PROCDUMP_PATH"] = Path.Combine(_testEnvironment.PackageDirectory, @"procdump\0.0.1\bin"),
["PROCDUMP_PATH"] = _procDumpPath
};

InvokeVsTest(arguments, env);
Expand All @@ -200,7 +210,7 @@ public void CrashDumpOnStackOverflow(RunnerInfo runnerInfo)

var env = new Dictionary<string, string>
{
["PROCDUMP_PATH"] = Path.Combine(_testEnvironment.PackageDirectory, @"procdump\0.0.1\bin"),
["PROCDUMP_PATH"] = _procDumpPath
};

InvokeVsTest(arguments, env);
Expand Down Expand Up @@ -313,14 +323,14 @@ private void ValidateDump(int expectedDumpCount = 1)
}
}

private void VaildateOutput(TempDirectory tempDir, string testName, bool validateDumpFile = false)
private void VaildateOutput(TempDirectory tempDirectory, string testName, bool validateDumpFile = false)
{
bool isSequenceAttachmentReceived = false;
bool isDumpAttachmentReceived = false;
bool isValid = false;
StdErrorContains(testName);
StdOutputContains("Sequence_");
var resultFiles = Directory.GetFiles(tempDir.Path, "*", SearchOption.AllDirectories);
var resultFiles = Directory.GetFiles(tempDirectory.Path, "*", SearchOption.AllDirectories);

foreach (var file in resultFiles)
{
Expand All @@ -335,9 +345,9 @@ private void VaildateOutput(TempDirectory tempDir, string testName, bool validat
}
}

Assert.IsTrue(isSequenceAttachmentReceived);
Assert.IsTrue(!validateDumpFile || isDumpAttachmentReceived);
Assert.IsTrue(isValid);
Assert.IsTrue(isSequenceAttachmentReceived, "Sequence attachment was not received.");
Assert.IsTrue(!validateDumpFile || isDumpAttachmentReceived, "Dump attachment was not received.");
Assert.IsTrue(isValid, "Sequence attachment is not valid.");
}

private bool IsValidXml(string xmlFilePath)
Expand Down
11 changes: 5 additions & 6 deletions test/Microsoft.TestPlatform.AcceptanceTests/CUITTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@ public class CuitTest : AcceptanceTestBase
public void CuitRunAllTests(RunnerInfo runnerInfo)
{
SetTestEnvironment(_testEnvironment, runnerInfo);
CuitRunAll(runnerInfo.RunnerFramework);
CuitRunAll(runnerInfo);
}

private void CuitRunAll(string runnerFramework)
private void CuitRunAll(RunnerInfo runnerInfo)
{
if (runnerFramework.StartsWith("netcoreapp"))
if (runnerInfo.IsNetRunner)
{
Assert.Inconclusive("CUIT tests are not supported with .Netcore runner.");
Assert.Inconclusive("CUIT tests are not supported with .NET Core runner.");
return;
}

var assemblyAbsolutePath = _testEnvironment.GetTestAsset("CUITTestProject.dll", "net451");
using var tempDir = new TempDirectory();
var arguments = PrepareArguments(assemblyAbsolutePath, string.Empty, string.Empty, FrameworkArgValue, resultsDirectory: tempDir.Path);
var arguments = PrepareArguments(assemblyAbsolutePath, string.Empty, string.Empty, FrameworkArgValue, resultsDirectory: TempDirectory.Path);

InvokeVsTest(arguments);
ValidateSummaryStatus(1, 0, 0);
Expand Down
17 changes: 8 additions & 9 deletions test/Microsoft.TestPlatform.AcceptanceTests/CodeCoverageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,9 @@ public void CollectCodeCoverageSpecifyOutputFormatCoberturaOverrideRunSettingsCo

private void CollectCodeCoverage(RunnerInfo runnerInfo, TestParameters testParameters)
{
using var tempDir = new TempDirectory();
SetTestEnvironment(_testEnvironment, runnerInfo);

var arguments = CreateArguments(tempDir, runnerInfo, testParameters, out var trxFilePath);
var arguments = CreateArguments(TempDirectory, runnerInfo, testParameters, out var trxFilePath);

InvokeVsTest(arguments);

Expand All @@ -220,8 +219,8 @@ private void CollectCodeCoverage(RunnerInfo runnerInfo, TestParameters testParam
testParameters.ExpectedSkippedTests,
testParameters.ExpectedFailedTests);

var actualCoverageFile = GetCoverageFileNameFromTrx(trxFilePath, tempDir.Path);
Console.WriteLine($@"Coverage file: {actualCoverageFile} Results directory: {tempDir.Path} trxfile: {trxFilePath}");
var actualCoverageFile = GetCoverageFileNameFromTrx(trxFilePath, TempDirectory.Path);
Console.WriteLine($@"Coverage file: {actualCoverageFile} Results directory: {TempDirectory.Path} trxfile: {trxFilePath}");
Assert.IsTrue(File.Exists(actualCoverageFile), "Coverage file not found: {0}", actualCoverageFile);

if (testParameters.RunSettingsType == TestParameters.SettingsType.XmlOutput)
Expand All @@ -237,7 +236,7 @@ private void CollectCodeCoverage(RunnerInfo runnerInfo, TestParameters testParam
Assert.IsTrue(actualCoverageFile.EndsWith(".coverage", StringComparison.InvariantCultureIgnoreCase));
}

var coverageDocument = GetXmlCoverage(actualCoverageFile, tempDir);
var coverageDocument = GetXmlCoverage(actualCoverageFile, TempDirectory);
if (testParameters.CheckSkipped)
{
AssertSkippedMethod(coverageDocument);
Expand All @@ -247,7 +246,7 @@ private void CollectCodeCoverage(RunnerInfo runnerInfo, TestParameters testParam
}

private string CreateArguments(
TempDirectory tempDir,
TempDirectory tempDirectory,
RunnerInfo runnerInfo,
TestParameters testParameters,
out string trxFilePath)
Expand All @@ -257,14 +256,14 @@ private string CreateArguments(
string traceDataCollectorDir = Path.Combine(IntegrationTestEnvironment.TestPlatformRootDirectory,
"artifacts", IntegrationTestEnvironment.BuildConfiguration, "Microsoft.CodeCoverage");

string diagFileName = Path.Combine(tempDir.Path, "diaglog.txt");
string diagFileName = Path.Combine(tempDirectory.Path, "diaglog.txt");
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty,
FrameworkArgValue, runnerInfo.InIsolationValue, tempDir.Path);
FrameworkArgValue, runnerInfo.InIsolationValue, tempDirectory.Path);
arguments = string.Concat(arguments, $" /Diag:{diagFileName}",
$" /TestAdapterPath:{traceDataCollectorDir}");
arguments = string.Concat(arguments, $" /Platform:{testParameters.TargetPlatform}");

trxFilePath = Path.Combine(tempDir.Path, Guid.NewGuid() + ".trx");
trxFilePath = Path.Combine(tempDirectory.Path, Guid.NewGuid() + ".trx");
arguments = string.Concat(arguments, " /logger:trx;logfilename=" + trxFilePath);

var defaultRunSettingsPath = Path.Combine(
Expand Down
Loading