Skip to content

Commit 81e1e74

Browse files
daveMuellerDavid Mueller IWSnohwnd
authored
Replacing calls to BuildMultipleAssemblyPath when passing only one source in acceptance tests (#4358)
* issue 3510 replacing calls to BuildMultipleAssemblyPath by GetASsetFullPath when passing only one source * Add quotes --------- Co-authored-by: David Mueller IWS <[email protected]> Co-authored-by: Jakub Jareš <[email protected]>
1 parent facbe98 commit 81e1e74

File tree

10 files changed

+32
-32
lines changed

10 files changed

+32
-32
lines changed

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void BlameDataCollectorShouldOutputDumpFile(RunnerInfo runnerInfo)
6565
{
6666

6767
SetTestEnvironment(_testEnvironment, runnerInfo);
68-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject3.dll");
68+
var assemblyPaths = GetAssetFullPath("SimpleTestProject3.dll");
6969
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue);
7070
arguments = string.Concat(arguments, $" /Blame:CollectDump");
7171
arguments = string.Concat(arguments, $" /ResultsDirectory:{TempDirectory.Path}");
@@ -89,7 +89,7 @@ public void BlameDataCollectorShouldNotOutputDumpFileWhenNoCrashOccurs(RunnerInf
8989
{
9090

9191
SetTestEnvironment(_testEnvironment, runnerInfo);
92-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject.dll");
92+
var assemblyPaths = GetAssetFullPath("SimpleTestProject.dll");
9393
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue);
9494
arguments = string.Concat(arguments, $" /Blame:CollectDump");
9595
arguments = string.Concat(arguments, $" /ResultsDirectory:{TempDirectory.Path}");
@@ -113,7 +113,7 @@ public void BlameDataCollectorShouldOutputDumpFileWhenNoCrashOccursButCollectAlw
113113
{
114114

115115
SetTestEnvironment(_testEnvironment, runnerInfo);
116-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject.dll");
116+
var assemblyPaths = GetAssetFullPath("SimpleTestProject.dll");
117117
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue);
118118
arguments = string.Concat(arguments, $" /Blame:CollectDump;CollectAlways=True");
119119
arguments = string.Concat(arguments, $" /ResultsDirectory:{TempDirectory.Path}");

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectionTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void ExecuteTestsWithDataCollection(RunnerInfo runnerInfo)
2626
{
2727
SetTestEnvironment(_testEnvironment, runnerInfo);
2828

29-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
29+
var assemblyPaths = GetAssetFullPath("SimpleTestProject2.dll");
3030
string runSettings = GetRunsettingsFilePath(TempDirectory.Path);
3131
string diagFileName = Path.Combine(TempDirectory.Path, "diaglog.txt");
3232
var extensionsPath = Path.GetDirectoryName(GetTestDllForFramework("OutOfProcDataCollector.dll", runnerInfo.RunnerFramework));
@@ -51,7 +51,7 @@ public void ExecuteTestsWithDataCollectionUsingCollectArgument(RunnerInfo runner
5151
{
5252
SetTestEnvironment(_testEnvironment, runnerInfo);
5353

54-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
54+
var assemblyPaths = GetAssetFullPath("SimpleTestProject2.dll");
5555
string diagFileName = Path.Combine(TempDirectory.Path, "diaglog.txt");
5656
var extensionsPath = Path.GetDirectoryName(GetTestDllForFramework("OutOfProcDataCollector.dll", runnerInfo.RunnerFramework));
5757

@@ -101,8 +101,8 @@ public void DataCollectorAttachmentProcessor(RunnerInfo runnerInfo)
101101
{
102102
SetTestEnvironment(_testEnvironment, runnerInfo);
103103

104-
var assemblyPath = BuildMultipleAssemblyPath("SimpleTestProject.dll");
105-
var secondAssemblyPath = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
104+
var assemblyPath = GetAssetFullPath("SimpleTestProject.dll");
105+
var secondAssemblyPath = GetAssetFullPath("SimpleTestProject2.dll");
106106
string runSettings = GetRunsettingsFilePath(TempDirectory.Path);
107107
string diagFileName = Path.Combine(TempDirectory.Path, "diaglog.txt");
108108
var extensionsPath = Path.GetDirectoryName(GetTestDllForFramework("AttachmentProcessorDataCollector.dll", "netstandard2.0"));

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectorTests.Coverlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void RunCoverletCoverage()
3131

3232
string coverletAdapterPath = Path.GetDirectoryName(Directory.GetFiles(_testEnvironment.GetNugetPackage("coverlet.collector"), "coverlet.collector.dll", SearchOption.AllDirectories).Single())!;
3333
string logId = Guid.NewGuid().ToString("N");
34-
string assemblyPath = BuildMultipleAssemblyPath("CoverletCoverageTestProject.dll").Trim('\"');
34+
string assemblyPath = GetAssetFullPath("CoverletCoverageTestProject.dll").Trim('\"');
3535
string logPath = Path.Combine(Path.GetDirectoryName(assemblyPath)!, $"coverletcoverage.{logId}.log");
3636
string logPathDirectory = Path.GetDirectoryName(logPath)!;
3737
string argument = $"--collect:{"XPlat Code Coverage".AddDoubleQuote()} {PrepareArguments(assemblyPath, coverletAdapterPath, "", ".NETCoreApp,Version=v2.1", resultsDirectory: resultsDir.Path)} --diag:{logPath.AddDoubleQuote()}";

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DebugAssertTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void RunningTestWithAFailingDebugAssertDoesNotCrashTheHostingProcess(Runn
1818
// is to not crash the process when we are running in debug, and debugger is attached
1919
SetTestEnvironment(_testEnvironment, runnerInfo);
2020

21-
var assemblyPath = BuildMultipleAssemblyPath("CrashingOnDebugAssertTestProject.dll");
21+
var assemblyPath = GetAssetFullPath("CrashingOnDebugAssertTestProject.dll");
2222
var arguments = PrepareArguments(assemblyPath, null, null, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
2323
InvokeVsTest(arguments);
2424

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void RunDotnetTestWithDll(RunnerInfo runnerInfo)
3838
{
3939
SetTestEnvironment(_testEnvironment, runnerInfo);
4040

41-
var assemblyPath = BuildMultipleAssemblyPath("SimpleTestProject.dll");
41+
var assemblyPath = GetAssetFullPath("SimpleTestProject.dll");
4242
InvokeDotnetTest($@"{assemblyPath} --logger:""Console;Verbosity=normal""");
4343

4444
// ensure our dev version is used
@@ -71,7 +71,7 @@ public void RunDotnetTestWithDllPassInlineSettings(RunnerInfo runnerInfo)
7171
{
7272
SetTestEnvironment(_testEnvironment, runnerInfo);
7373

74-
var assemblyPath = BuildMultipleAssemblyPath("ParametrizedTestProject.dll");
74+
var assemblyPath = GetAssetFullPath("ParametrizedTestProject.dll");
7575
InvokeDotnetTest($@"{assemblyPath} --logger:""Console;Verbosity=normal"" -- TestRunParameters.Parameter(name=\""weburl\"", value=\""http://localhost//def\"")");
7676

7777
ValidateSummaryStatus(1, 0, 0);

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ExecutionTests.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ public void RunMultipleTestAssembliesWithoutTestAdapterPath(RunnerInfo runnerInf
9494
{
9595
SetTestEnvironment(_testEnvironment, runnerInfo);
9696

97-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject.dll");
97+
var assemblyPath = GetAssetFullPath("SimpleTestProject.dll");
9898
var xunitAssemblyPath = _testEnvironment.GetTestAsset("XUTestProject.dll");
9999

100-
assemblyPaths = string.Join(" ", assemblyPaths, xunitAssemblyPath.AddDoubleQuote());
101-
InvokeVsTestForExecution(assemblyPaths, testAdapterPath: string.Empty, FrameworkArgValue, string.Empty);
100+
assemblyPath = string.Join(" ", assemblyPath.AddDoubleQuote(), xunitAssemblyPath.AddDoubleQuote());
101+
InvokeVsTestForExecution(assemblyPath, testAdapterPath: string.Empty, FrameworkArgValue, string.Empty);
102102

103103
ValidateSummaryStatus(2, 2, 1);
104104
ExitCodeEquals(1); // failing tests
@@ -143,7 +143,7 @@ public void TestSessionTimeOutTests(RunnerInfo runnerInfo)
143143
SetTestEnvironment(_testEnvironment, runnerInfo);
144144

145145
var assemblyPaths =
146-
BuildMultipleAssemblyPath("SimpleTestProject3.dll");
146+
GetAssetFullPath("SimpleTestProject3.dll");
147147
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
148148
arguments = string.Concat(arguments, " /TestCaseFilter:TestSessionTimeoutTest");
149149

@@ -163,7 +163,7 @@ public void TestPlatformShouldBeCompatibleWithOldTestHost(RunnerInfo runnerInfo)
163163
{
164164
SetTestEnvironment(_testEnvironment, runnerInfo);
165165

166-
var assemblyPaths = BuildMultipleAssemblyPath("SampleProjectWithOldTestHost.dll");
166+
var assemblyPaths = GetAssetFullPath("SampleProjectWithOldTestHost.dll");
167167
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
168168

169169
InvokeVsTest(arguments);
@@ -179,7 +179,7 @@ public void WorkingDirectoryIsSourceDirectory(RunnerInfo runnerInfo)
179179
{
180180
SetTestEnvironment(_testEnvironment, runnerInfo);
181181

182-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject3.dll");
182+
var assemblyPaths = GetAssetFullPath("SimpleTestProject3.dll");
183183
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
184184
arguments = string.Concat(arguments, " /tests:WorkingDirectoryTest");
185185

@@ -206,7 +206,7 @@ public void StackOverflowExceptionShouldBeLoggedToConsoleAndDiagLogFile(RunnerIn
206206
var diagLogFilePath = Path.Combine(TempDirectory.Path, $"std_error_log_{Guid.NewGuid()}.txt");
207207
File.Delete(diagLogFilePath);
208208

209-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject3.dll");
209+
var assemblyPaths = GetAssetFullPath("SimpleTestProject3.dll");
210210
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
211211
arguments = string.Concat(arguments, " /testcasefilter:ExitWithStackoverFlow");
212212
arguments = string.Concat(arguments, $" /diag:{diagLogFilePath}");
@@ -236,7 +236,7 @@ public void UnhandleExceptionExceptionShouldBeLoggedToDiagLogFile(RunnerInfo run
236236
File.Delete(diagLogFilePath);
237237

238238
var assemblyPaths =
239-
BuildMultipleAssemblyPath("SimpleTestProject3.dll");
239+
GetAssetFullPath("SimpleTestProject3.dll");
240240
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
241241
arguments = string.Concat(arguments, " /testcasefilter:ExitwithUnhandleException");
242242
arguments = string.Concat(arguments, $" /diag:{diagLogFilePath}");
@@ -282,7 +282,7 @@ public void NoIncompatibleSourcesWarningShouldBeDisplayedInTheConsoleWhenGivenSi
282282

283283
var expectedWarningContains = @"Following DLL(s) do not match current settings, which are .NETFramework,Version=v4.6.2 framework and X86 platform. SimpleTestProjectx86 would use Framework .NETFramework,Version=v4.6.2 and Platform X86";
284284
var assemblyPaths =
285-
BuildMultipleAssemblyPath("SimpleTestProjectx86.dll");
285+
GetAssetFullPath("SimpleTestProjectx86.dll");
286286
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
287287

288288
InvokeVsTest(arguments + " /diag:logs\\");
@@ -302,7 +302,7 @@ public void IncompatibleSourcesWarningShouldBeDisplayedInTheConsoleOnlyWhenRunni
302302

303303
var expectedWarningContains = @"Following DLL(s) do not match current settings, which are .NETFramework,Version=v4.6.2 framework and X86 platform. SimpleTestProject2.dll would use Framework .NETFramework,Version=v4.6.2 and Platform X64";
304304
var assemblyPaths =
305-
BuildMultipleAssemblyPath("SimpleTestProject2.dll");
305+
GetAssetFullPath("SimpleTestProject2.dll");
306306
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
307307

308308
InvokeVsTest(arguments);
@@ -330,7 +330,7 @@ public void ExitCodeShouldReturnOneWhenTreatNoTestsAsErrorParameterSetToTrueAndN
330330
{
331331
SetTestEnvironment(_testEnvironment, runnerInfo);
332332

333-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
333+
var assemblyPaths = GetAssetFullPath("SimpleTestProject2.dll");
334334

335335
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
336336

@@ -350,7 +350,7 @@ public void ExitCodeShouldReturnZeroWhenTreatNoTestsAsErrorParameterSetToFalseAn
350350
{
351351
SetTestEnvironment(_testEnvironment, runnerInfo);
352352

353-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
353+
var assemblyPaths = GetAssetFullPath("SimpleTestProject2.dll");
354354
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
355355

356356
// Setting /TestCaseFilter to the test name, which does not exists in the assembly, so we will have 0 tests executed
@@ -369,7 +369,7 @@ public void ExitCodeShouldNotDependOnTreatNoTestsAsErrorTrueValueWhenThereAreAny
369369
{
370370
SetTestEnvironment(_testEnvironment, runnerInfo);
371371

372-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
372+
var assemblyPaths = GetAssetFullPath("SimpleTestProject2.dll");
373373

374374
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
375375

@@ -387,7 +387,7 @@ public void ExitCodeShouldNotDependOnFailTreatNoTestsAsErrorFalseValueWhenThereA
387387
{
388388
SetTestEnvironment(_testEnvironment, runnerInfo);
389389

390-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
390+
var assemblyPaths = GetAssetFullPath("SimpleTestProject2.dll");
391391
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
392392

393393
arguments = string.Concat(arguments, " -- RunConfiguration.TreatNoTestsAsError=false");

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ExecutionThreadApartmentStateTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public void UITestShouldPassIfApartmentStateIsSTA(RunnerInfo runnerInfo)
1616
{
1717
SetTestEnvironment(_testEnvironment, runnerInfo);
1818

19-
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject3.dll");
19+
var assemblyPaths = GetAssetFullPath("SimpleTestProject3.dll");
2020
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
2121
arguments = string.Concat(arguments, " /testcasefilter:UITestMethod");
2222
InvokeVsTest(arguments);
@@ -30,7 +30,7 @@ public void WarningShouldBeShownWhenValueIsSTAForNetCore(RunnerInfo runnerInfo)
3030
SetTestEnvironment(_testEnvironment, runnerInfo);
3131

3232
var assemblyPaths =
33-
BuildMultipleAssemblyPath("SimpleTestProject2.dll");
33+
GetAssetFullPath("SimpleTestProject2.dll");
3434
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
3535
arguments = string.Concat(arguments, " /testcasefilter:PassingTest2 -- RunConfiguration.ExecutionThreadApartmentState=STA");
3636
InvokeVsTest(arguments);
@@ -45,7 +45,7 @@ public void UITestShouldFailWhenDefaultApartmentStateIsMTA(RunnerInfo runnerInfo
4545
SetTestEnvironment(_testEnvironment, runnerInfo);
4646

4747
var assemblyPaths =
48-
BuildMultipleAssemblyPath("SimpleTestProject3.dll");
48+
GetAssetFullPath("SimpleTestProject3.dll");
4949
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
5050
arguments = string.Concat(arguments, " /testcasefilter:UITestMethod -- RunConfiguration.ExecutionThreadApartmentState=MTA");
5151
InvokeVsTest(arguments);
@@ -60,7 +60,7 @@ public void CancelTestExectionShouldWorkWhenApartmentStateIsSTA(RunnerInfo runne
6060
SetTestEnvironment(_testEnvironment, runnerInfo);
6161

6262
var assemblyPaths =
63-
BuildMultipleAssemblyPath("SimpleTestProject3.dll");
63+
GetAssetFullPath("SimpleTestProject3.dll");
6464
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
6565
arguments = string.Concat(arguments, " /tests:UITestWithSleep1,UITestMethod -- RunConfiguration.ExecutionThreadApartmentState=STA RunConfiguration.TestSessionTimeout=2000");
6666
InvokeVsTest(arguments);

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/MultitargetingTestHostTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void TestRunInATesthostThatTargetsTheirChosenNETFramework(RunnerInfo runn
2121
{
2222
SetTestEnvironment(_testEnvironment, runnerInfo);
2323

24-
var assemblyPath = BuildMultipleAssemblyPath("MultitargetedNetFrameworkProject.dll");
24+
var assemblyPath = GetAssetFullPath("MultitargetedNetFrameworkProject.dll");
2525
var arguments = PrepareArguments(assemblyPath, null, null, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
2626

2727
// Tell the test project which target framework we are expecting it to run as.

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RecursiveResourcesLookupTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void RunsToCompletionWhenJapaneseResourcesAreLookedUpForMSCorLib(RunnerIn
1717
{
1818
SetTestEnvironment(_testEnvironment, runnerInfo);
1919

20-
var assemblyPath = BuildMultipleAssemblyPath("RecursiveResourceLookupCrash.dll");
20+
var assemblyPath = GetAssetFullPath("RecursiveResourceLookupCrash.dll");
2121
var arguments = PrepareArguments(assemblyPath, null, null, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
2222
InvokeVsTest(arguments);
2323

test/Microsoft.TestPlatform.Acceptance.IntegrationTests/SelfContainedAppTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void RunningApplicationThatIsBuiltAsSelfContainedWillNotFailToFindHostpol
2323
SetTestEnvironment(_testEnvironment, runnerInfo);
2424

2525
// the app is published to win10-x64 because of the runtime identifier in the project
26-
var assemblyPath = BuildMultipleAssemblyPath($@"win10-x64{Path.DirectorySeparatorChar}SelfContainedAppTestProject.dll");
26+
var assemblyPath = GetAssetFullPath($@"win10-x64{Path.DirectorySeparatorChar}SelfContainedAppTestProject.dll");
2727
var arguments = PrepareArguments(assemblyPath, null, null, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
2828
InvokeVsTest(arguments);
2929

0 commit comments

Comments
 (0)