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

Replacing calls to BuildMultipleAssemblyPath when passing only one source in acceptance tests #4358

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void BlameDataCollectorShouldOutputDumpFile(RunnerInfo runnerInfo)
{

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

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

SetTestEnvironment(_testEnvironment, runnerInfo);
var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject.dll");
var assemblyPaths = GetAssetFullPath("SimpleTestProject.dll");
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue);
arguments = string.Concat(arguments, $" /Blame:CollectDump;CollectAlways=True");
arguments = string.Concat(arguments, $" /ResultsDirectory:{TempDirectory.Path}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void ExecuteTestsWithDataCollection(RunnerInfo runnerInfo)
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

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

Expand Down Expand Up @@ -101,8 +101,8 @@ public void DataCollectorAttachmentProcessor(RunnerInfo runnerInfo)
{
SetTestEnvironment(_testEnvironment, runnerInfo);

var assemblyPath = BuildMultipleAssemblyPath("SimpleTestProject.dll");
var secondAssemblyPath = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
var assemblyPath = GetAssetFullPath("SimpleTestProject.dll");
var secondAssemblyPath = GetAssetFullPath("SimpleTestProject2.dll");
string runSettings = GetRunsettingsFilePath(TempDirectory.Path);
string diagFileName = Path.Combine(TempDirectory.Path, "diaglog.txt");
var extensionsPath = Path.GetDirectoryName(GetTestDllForFramework("AttachmentProcessorDataCollector.dll", "netstandard2.0"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void RunCoverletCoverage()

string coverletAdapterPath = Path.GetDirectoryName(Directory.GetFiles(_testEnvironment.GetNugetPackage("coverlet.collector"), "coverlet.collector.dll", SearchOption.AllDirectories).Single())!;
string logId = Guid.NewGuid().ToString("N");
string assemblyPath = BuildMultipleAssemblyPath("CoverletCoverageTestProject.dll").Trim('\"');
string assemblyPath = GetAssetFullPath("CoverletCoverageTestProject.dll").Trim('\"');
string logPath = Path.Combine(Path.GetDirectoryName(assemblyPath)!, $"coverletcoverage.{logId}.log");
string logPathDirectory = Path.GetDirectoryName(logPath)!;
string argument = $"--collect:{"XPlat Code Coverage".AddDoubleQuote()} {PrepareArguments(assemblyPath, coverletAdapterPath, "", ".NETCoreApp,Version=v2.1", resultsDirectory: resultsDir.Path)} --diag:{logPath.AddDoubleQuote()}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void RunningTestWithAFailingDebugAssertDoesNotCrashTheHostingProcess(Runn
// is to not crash the process when we are running in debug, and debugger is attached
SetTestEnvironment(_testEnvironment, runnerInfo);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void RunDotnetTestWithDll(RunnerInfo runnerInfo)
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

// ensure our dev version is used
Expand Down Expand Up @@ -71,7 +71,7 @@ public void RunDotnetTestWithDllPassInlineSettings(RunnerInfo runnerInfo)
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

ValidateSummaryStatus(1, 0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void RunMultipleTestAssembliesWithoutTestAdapterPath(RunnerInfo runnerInf
{
SetTestEnvironment(_testEnvironment, runnerInfo);

var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject.dll");
var assemblyPaths = GetAssetFullPath("SimpleTestProject.dll");
var xunitAssemblyPath = _testEnvironment.GetTestAsset("XUTestProject.dll");

assemblyPaths = string.Join(" ", assemblyPaths, xunitAssemblyPath.AddDoubleQuote());
Expand Down Expand Up @@ -143,7 +143,7 @@ public void TestSessionTimeOutTests(RunnerInfo runnerInfo)
SetTestEnvironment(_testEnvironment, runnerInfo);

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

Expand All @@ -163,7 +163,7 @@ public void TestPlatformShouldBeCompatibleWithOldTestHost(RunnerInfo runnerInfo)
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

InvokeVsTest(arguments);
Expand All @@ -179,7 +179,7 @@ public void WorkingDirectoryIsSourceDirectory(RunnerInfo runnerInfo)
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

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

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

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

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";
var assemblyPaths =
BuildMultipleAssemblyPath("SimpleTestProjectx86.dll");
GetAssetFullPath("SimpleTestProjectx86.dll");
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);

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

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";
var assemblyPaths =
BuildMultipleAssemblyPath("SimpleTestProject2.dll");
GetAssetFullPath("SimpleTestProject2.dll");
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);

InvokeVsTest(arguments);
Expand Down Expand Up @@ -330,7 +330,7 @@ public void ExitCodeShouldReturnOneWhenTreatNoTestsAsErrorParameterSetToTrueAndN
{
SetTestEnvironment(_testEnvironment, runnerInfo);

var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
var assemblyPaths = GetAssetFullPath("SimpleTestProject2.dll");

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

Expand All @@ -350,7 +350,7 @@ public void ExitCodeShouldReturnZeroWhenTreatNoTestsAsErrorParameterSetToFalseAn
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

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

var assemblyPaths = BuildMultipleAssemblyPath("SimpleTestProject2.dll");
var assemblyPaths = GetAssetFullPath("SimpleTestProject2.dll");

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

Expand All @@ -387,7 +387,7 @@ public void ExitCodeShouldNotDependOnFailTreatNoTestsAsErrorFalseValueWhenThereA
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

arguments = string.Concat(arguments, " -- RunConfiguration.TreatNoTestsAsError=false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void UITestShouldPassIfApartmentStateIsSTA(RunnerInfo runnerInfo)
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

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

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

var assemblyPaths =
BuildMultipleAssemblyPath("SimpleTestProject3.dll");
GetAssetFullPath("SimpleTestProject3.dll");
var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path);
arguments = string.Concat(arguments, " /tests:UITestWithSleep1,UITestMethod -- RunConfiguration.ExecutionThreadApartmentState=STA RunConfiguration.TestSessionTimeout=2000");
InvokeVsTest(arguments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void TestRunInATesthostThatTargetsTheirChosenNETFramework(RunnerInfo runn
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

// Tell the test project which target framework we are expecting it to run as.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void RunsToCompletionWhenJapaneseResourcesAreLookedUpForMSCorLib(RunnerIn
{
SetTestEnvironment(_testEnvironment, runnerInfo);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void RunningApplicationThatIsBuiltAsSelfContainedWillNotFailToFindHostpol
SetTestEnvironment(_testEnvironment, runnerInfo);

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

Expand Down