From 23b29476a323fde91c2be9460fa063a6f6f6eb3f Mon Sep 17 00:00:00 2001 From: David Raygoza Date: Wed, 19 Jul 2023 12:32:31 -0700 Subject: [PATCH] Change some variable names Instead of using FQNWithNS we use FQNWithoutNS and FQN. This makes more logical sense since a FQN is supposed to contain a NS anyways. --- .../Core.Tests/GoogleTestDiscovererTests.cs | 18 +++++------ .../DurationBasedTestsSplitterTests.cs | 6 ++-- .../TestCases/TestCaseFactoryTests.cs | 4 +-- .../StandardOutputTestResultParserTests.cs | 26 ++++++++-------- ...mingStandardOutputTestResultParserTests.cs | 30 +++++++++---------- GoogleTestAdapter/Core/Model/TestCase.cs | 10 +++---- .../Core/Runners/CommandLineGenerator.cs | 6 ++-- .../Core/Runners/ParallelTestRunner.cs | 2 +- .../Core/Runners/SequentialTestRunner.cs | 8 ++--- .../Core/Runners/TestResultCollector.cs | 4 +-- .../Core/Scheduling/SchedulingAnalyzer.cs | 2 +- .../Core/Scheduling/TestDurationSerializer.cs | 6 ++-- .../Core/TestCases/TestCaseFactory.cs | 4 +-- .../StandardOutputTestResultParser.cs | 2 +- .../Core/TestResults/XmlTestResultParser.cs | 2 +- .../TestAdapter/DataConversionExtensions.cs | 2 +- GoogleTestAdapter/TestAdapter/TestExecutor.cs | 2 +- .../Tests.Common/TestDataCreator.cs | 6 ++-- 18 files changed, 70 insertions(+), 70 deletions(-) diff --git a/GoogleTestAdapter/Core.Tests/GoogleTestDiscovererTests.cs b/GoogleTestAdapter/Core.Tests/GoogleTestDiscovererTests.cs index 50f1e58f1..4d104ce26 100644 --- a/GoogleTestAdapter/Core.Tests/GoogleTestDiscovererTests.cs +++ b/GoogleTestAdapter/Core.Tests/GoogleTestDiscovererTests.cs @@ -283,7 +283,7 @@ public void GetTestsFromExecutable_DoNotParseSymbolInformation_DiaIsNotInvoked() testCase.LineNumber.Should().Be(0); testCase.Source.Should().Be(TestResources.Tests_DebugX86); testCase.DisplayName.Should().NotBeNullOrEmpty(); - testCase.FullyQualifiedName.Should().NotBeNullOrEmpty(); + testCase.FullyQualifiedNameWithoutNamespace.Should().NotBeNullOrEmpty(); } } @@ -309,8 +309,8 @@ public void DiscoverTests_TestDiscoveryParam_TestsFoundWithAdditionalDiscoveryPa discoverer.DiscoverTests(TestResources.TestDiscoveryParamExe.Yield(), MockFrameworkReporter.Object); testCases.Count.Should().Be(2); - testCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestFails"); - testCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestPasses"); + testCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestFails"); + testCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestPasses"); } [TestMethod] @@ -323,8 +323,8 @@ public void GetTestsFromExecubable_TestDiscoveryParam_TestsFoundWithAdditionalDi IList testCases = discoverer.GetTestsFromExecutable(TestResources.TestDiscoveryParamExe); testCases.Count.Should().Be(2); - testCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestFails"); - testCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestPasses"); + testCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestFails"); + testCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestPasses"); } [TestMethod] @@ -338,7 +338,7 @@ public void GetTestsFromExecutable_LoadTests_AllTestsAreFound() for (int i = 0; i < 5000; i++) { string fullyQualifiedName = $"LoadTests.Test/{i}"; - bool contains = testCases.Any(tc => tc.FullyQualifiedName == fullyQualifiedName); + bool contains = testCases.Any(tc => tc.FullyQualifiedNameWithoutNamespace == fullyQualifiedName); contains.Should().BeTrue($" Test not found: {fullyQualifiedName}"); } } @@ -374,12 +374,12 @@ private void FindTests(string location) testCases.Count.Should().Be(TestResources.NrOfTests); - TestCase testCase = testCases.Single(tc => tc.FullyQualifiedName == "TheFixture.AddFails"); + TestCase testCase = testCases.Single(tc => tc.FullyQualifiedNameWithoutNamespace == "TheFixture.AddFails"); testCase.DisplayName.Should().Be("TheFixture.AddFails"); testCase.CodeFilePath.Should().EndWith(@"sampletests\tests\fixturetests.cpp"); testCase.LineNumber.Should().Be(11); - testCase = testCases.Single(tc => tc.FullyQualifiedName == "Arr/TypeParameterizedTests/1.CanDefeatMath"); + testCase = testCases.Single(tc => tc.FullyQualifiedNameWithoutNamespace == "Arr/TypeParameterizedTests/1.CanDefeatMath"); testCase.DisplayName.Should().Be("Arr/TypeParameterizedTests/1.CanDefeatMath"); testCase.CodeFilePath.Should().EndWith(@"sampletests\tests\typeparameterizedtests.cpp"); testCase.LineNumber.Should().Be(53); @@ -416,7 +416,7 @@ private void AssertFindsTest(string fullyQualifiedName, Regex displayNameRegex) var discoverer = new GoogleTestDiscoverer(TestEnvironment.Logger, TestEnvironment.Options); IList tests = discoverer.GetTestsFromExecutable(TestResources.Tests_DebugX86); - TestCase testCase = tests.Single(t => t.FullyQualifiedName == fullyQualifiedName); + TestCase testCase = tests.Single(t => t.FullyQualifiedNameWithoutNamespace == fullyQualifiedName); testCase.DisplayName.Should().MatchRegex(displayNameRegex.ToString()); } diff --git a/GoogleTestAdapter/Core.Tests/Scheduling/DurationBasedTestsSplitterTests.cs b/GoogleTestAdapter/Core.Tests/Scheduling/DurationBasedTestsSplitterTests.cs index ccbce4c48..f8e817762 100644 --- a/GoogleTestAdapter/Core.Tests/Scheduling/DurationBasedTestsSplitterTests.cs +++ b/GoogleTestAdapter/Core.Tests/Scheduling/DurationBasedTestsSplitterTests.cs @@ -28,7 +28,7 @@ public void SplitTestcases_SimpleCase_TestsAreDistributedCorrectly() result.Count.Should().Be(2); result[0].Count.Should().Be(1); - result[0][0].FullyQualifiedName.Should().Be("LongTest"); + result[0][0].FullyQualifiedNameWithoutNamespace.Should().Be("LongTest"); result[1].Count.Should().Be(3); } @@ -49,7 +49,7 @@ public void SplitTestcases_SimpleCaseWithThreeThreads_TestsAreDistributedCorrect result.Count.Should().Be(3); result[0].Count.Should().Be(1); - result[0][0].FullyQualifiedName.Should().Be("LongTest"); + result[0][0].FullyQualifiedNameWithoutNamespace.Should().Be("LongTest"); result[1].Count.Should().Be(2); result[2].Count.Should().Be(1); } @@ -69,7 +69,7 @@ public void SplitTestcases_AsymmetricCase_TestsAreDistributedCorrectly() result.Count.Should().Be(2); result[0].Count.Should().Be(1); - result[0][0].FullyQualifiedName.Should().Be("LongTest"); + result[0][0].FullyQualifiedNameWithoutNamespace.Should().Be("LongTest"); result[1].Count.Should().Be(1); } diff --git a/GoogleTestAdapter/Core.Tests/TestCases/TestCaseFactoryTests.cs b/GoogleTestAdapter/Core.Tests/TestCases/TestCaseFactoryTests.cs index e92a7db13..8b0126363 100644 --- a/GoogleTestAdapter/Core.Tests/TestCases/TestCaseFactoryTests.cs +++ b/GoogleTestAdapter/Core.Tests/TestCases/TestCaseFactoryTests.cs @@ -48,8 +48,8 @@ public void CreateTestCases_AdditionalTestDiscoveryParam_TestDiscoveryUsesAdditi var returnedTestCases = factory.CreateTestCases(testCase => reportedTestCases.Add(testCase)); reportedTestCases.Count.Should().Be(2); - reportedTestCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestFails"); - reportedTestCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestPasses"); + reportedTestCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestFails"); + reportedTestCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestPasses"); } } diff --git a/GoogleTestAdapter/Core.Tests/TestResults/StandardOutputTestResultParserTests.cs b/GoogleTestAdapter/Core.Tests/TestResults/StandardOutputTestResultParserTests.cs index ab0a51f1f..95df970fc 100644 --- a/GoogleTestAdapter/Core.Tests/TestResults/StandardOutputTestResultParserTests.cs +++ b/GoogleTestAdapter/Core.Tests/TestResults/StandardOutputTestResultParserTests.cs @@ -143,7 +143,7 @@ public void GetTestResults_CompleteOutput_ParsedCorrectly() results.Count.Should().Be(3); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); XmlTestResultParserTests.AssertTestResultIsFailure(results[0]); results[0].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(3)); @@ -151,11 +151,11 @@ public void GetTestResults_CompleteOutput_ParsedCorrectly() .Contain( @"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp"); - results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsPassed(results[1]); results[1].Duration.Should().Be(StandardOutputTestResultParser.ShortTestDuration); - results[2].TestCase.FullyQualifiedName.Should().Be("TestMath.Crash"); + results[2].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.Crash"); XmlTestResultParserTests.AssertTestResultIsFailure(results[2]); results[2].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText); results[2].Duration.Should().Be(TimeSpan.FromMilliseconds(9)); @@ -169,13 +169,13 @@ public void GetTestResults_OutputWithImmediateCrash_CorrectResultHasCrashText() results.Count.Should().Be(2); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); XmlTestResultParserTests.AssertTestResultIsFailure(results[0]); results[0].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(3)); results[0].ErrorStackTrace.Should().Contain(@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp"); - results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsFailure(results[1]); results[1].ErrorMessage.Should().Contain(StandardOutputTestResultParser.CrashText); results[1].ErrorMessage.Should().NotContain("Test output:"); @@ -190,17 +190,17 @@ public void GetTestResults_OutputWithCrashAfterErrorMessage_CorrectResultHasCras results.Count.Should().Be(3); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); XmlTestResultParserTests.AssertTestResultIsFailure(results[0]); results[0].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(3)); results[0].ErrorStackTrace.Should().Contain(@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp"); - results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsPassed(results[1]); results[1].Duration.Should().Be(StandardOutputTestResultParser.ShortTestDuration); - results[2].TestCase.FullyQualifiedName.Should().Be("TestMath.Crash"); + results[2].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.Crash"); XmlTestResultParserTests.AssertTestResultIsFailure(results[2]); results[2].ErrorMessage.Should().Contain(StandardOutputTestResultParser.CrashText); results[2].ErrorMessage.Should().Contain("Test output:"); @@ -215,7 +215,7 @@ public void GetTestResults_OutputWithInvalidDurationUnit_DefaultDurationIsUsedAn List results = ComputeTestResults(WrongDurationUnit); results.Count.Should().Be(1); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(1)); results[0].ErrorStackTrace.Should().Contain(@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp"); @@ -234,7 +234,7 @@ public void GetTestResults_OutputWithThousandsSeparatorInDuration_ParsedCorrectl List results = ComputeTestResults(ThousandsSeparatorInDuration); results.Count.Should().Be(1); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(4656)); } finally @@ -250,7 +250,7 @@ public void GetTestResults_OutputWithConsoleOutput_ConsoleOutputIsIgnored() List results = ComputeTestResults(PassingTestProducesConsoleOutput); results.Count.Should().Be(1); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsPassed(results[0]); } @@ -270,9 +270,9 @@ public void GetTestResults_OutputWithPrefixingTest_BothTestsAreFound() .GetTestResults(); results.Count.Should().Be(2); - results[0].TestCase.FullyQualifiedName.Should().Be("Test.AB"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("Test.AB"); XmlTestResultParserTests.AssertTestResultIsPassed(results[0]); - results[1].TestCase.FullyQualifiedName.Should().Be("Test.A"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("Test.A"); XmlTestResultParserTests.AssertTestResultIsPassed(results[1]); } diff --git a/GoogleTestAdapter/Core.Tests/TestResults/StreamingStandardOutputTestResultParserTests.cs b/GoogleTestAdapter/Core.Tests/TestResults/StreamingStandardOutputTestResultParserTests.cs index 34699aa6b..59f1ed584 100644 --- a/GoogleTestAdapter/Core.Tests/TestResults/StreamingStandardOutputTestResultParserTests.cs +++ b/GoogleTestAdapter/Core.Tests/TestResults/StreamingStandardOutputTestResultParserTests.cs @@ -163,7 +163,7 @@ public void GetTestResults_CompleteOutput_ParsedCorrectly() results.Count.Should().Be(3); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); XmlTestResultParserTests.AssertTestResultIsFailure(results[0]); results[0].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(3)); @@ -171,11 +171,11 @@ public void GetTestResults_CompleteOutput_ParsedCorrectly() .Contain( @"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp"); - results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsPassed(results[1]); results[1].Duration.Should().Be(StandardOutputTestResultParser.ShortTestDuration); - results[2].TestCase.FullyQualifiedName.Should().Be("TestMath.Crash"); + results[2].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.Crash"); XmlTestResultParserTests.AssertTestResultIsFailure(results[2]); results[2].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText); results[2].Duration.Should().Be(TimeSpan.FromMilliseconds(9)); @@ -189,13 +189,13 @@ public void GetTestResults_OutputWithImmediateCrash_CorrectResultHasCrashText() results.Count.Should().Be(2); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); XmlTestResultParserTests.AssertTestResultIsFailure(results[0]); results[0].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(3)); results[0].ErrorStackTrace.Should().Contain(@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp"); - results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsFailure(results[1]); results[1].ErrorMessage.Should().Contain(StandardOutputTestResultParser.CrashText); results[1].ErrorMessage.Should().NotContain("Test output:"); @@ -210,17 +210,17 @@ public void GetTestResults_OutputWithCrashAfterErrorMessage_CorrectResultHasCras results.Count.Should().Be(3); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); XmlTestResultParserTests.AssertTestResultIsFailure(results[0]); results[0].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(3)); results[0].ErrorStackTrace.Should().Contain(@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp"); - results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsPassed(results[1]); results[1].Duration.Should().Be(StandardOutputTestResultParser.ShortTestDuration); - results[2].TestCase.FullyQualifiedName.Should().Be("TestMath.Crash"); + results[2].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.Crash"); XmlTestResultParserTests.AssertTestResultIsFailure(results[2]); results[2].ErrorMessage.Should().Contain(StandardOutputTestResultParser.CrashText); results[2].ErrorMessage.Should().Contain("Test output:"); @@ -236,7 +236,7 @@ public void GetTestResults_OutputWithPrefixedPassedLine_PassingTestIsRecognized( results.Count.Should().Be(3); - results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsPassed(results[1]); results[1].Duration.Should().Be(StandardOutputTestResultParser.ShortTestDuration); } @@ -249,7 +249,7 @@ public void GetTestResults_OutputWithPrefixedFailedLine_FailingTestIsRecognized( results.Count.Should().Be(3); - results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsFailure(results[1]); results[1].ErrorMessage.Should().Contain("DummyOutput"); results[1].Duration.Should().Be(StandardOutputTestResultParser.ShortTestDuration); @@ -262,7 +262,7 @@ public void GetTestResults_OutputWithInvalidDurationUnit_DefaultDurationIsUsedAn IList results = ComputeTestResults(WrongDurationUnit); results.Count.Should().Be(1); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(1)); results[0].ErrorStackTrace.Should().Contain(@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp"); @@ -281,7 +281,7 @@ public void GetTestResults_OutputWithThousandsSeparatorInDuration_ParsedCorrectl IList results = ComputeTestResults(ThousandsSeparatorInDuration); results.Count.Should().Be(1); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails"); results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(4656)); } finally @@ -297,7 +297,7 @@ public void GetTestResults_OutputWithConsoleOutput_ConsoleOutputIsIgnored() IList results = ComputeTestResults(PassingTestProducesConsoleOutput); results.Count.Should().Be(1); - results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses"); XmlTestResultParserTests.AssertTestResultIsPassed(results[0]); } @@ -317,9 +317,9 @@ public void GetTestResults_OutputWithPrefixingTest_BothTestsAreFound() .GetTestResults(); results.Count.Should().Be(2); - results[0].TestCase.FullyQualifiedName.Should().Be("Test.AB"); + results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("Test.AB"); XmlTestResultParserTests.AssertTestResultIsPassed(results[0]); - results[1].TestCase.FullyQualifiedName.Should().Be("Test.A"); + results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("Test.A"); XmlTestResultParserTests.AssertTestResultIsPassed(results[1]); } diff --git a/GoogleTestAdapter/Core/Model/TestCase.cs b/GoogleTestAdapter/Core/Model/TestCase.cs index 0bddf759a..51f0f88fc 100644 --- a/GoogleTestAdapter/Core/Model/TestCase.cs +++ b/GoogleTestAdapter/Core/Model/TestCase.cs @@ -6,8 +6,8 @@ public class TestCase { public string Source { get; } + public string FullyQualifiedNameWithoutNamespace { get; } public string FullyQualifiedName { get; } - public string FullyQualifiedNameWithNamespace { get; } public string DisplayName { get; } public string CodeFilePath { get; } @@ -16,10 +16,10 @@ public class TestCase public List Traits { get; } = new List(); public List Properties { get; } = new List(); - public TestCase(string fullyQualifiedName, string fullyQualifiedNameWithNamespace, string source, string displayName, string codeFilePath, int lineNumber) + public TestCase(string fullyQualifiedNameWithoutNamespace, string fullyQualifiedName, string source, string displayName, string codeFilePath, int lineNumber) { + FullyQualifiedNameWithoutNamespace = fullyQualifiedNameWithoutNamespace; FullyQualifiedName = fullyQualifiedName; - FullyQualifiedNameWithNamespace = fullyQualifiedNameWithNamespace; Source = source; DisplayName = displayName; CodeFilePath = codeFilePath; @@ -33,13 +33,13 @@ public override bool Equals(object obj) if (other == null) return false; - return FullyQualifiedName == other.FullyQualifiedName && Source == other.Source; + return FullyQualifiedNameWithoutNamespace == other.FullyQualifiedNameWithoutNamespace && Source == other.Source; } public override int GetHashCode() { int hash = 17; - hash = hash * 31 + FullyQualifiedName.GetHashCode(); + hash = hash * 31 + FullyQualifiedNameWithoutNamespace.GetHashCode(); hash = hash * 31 + Source.GetHashCode(); return hash; } diff --git a/GoogleTestAdapter/Core/Runners/CommandLineGenerator.cs b/GoogleTestAdapter/Core/Runners/CommandLineGenerator.cs index 849e29596..264eb5361 100644 --- a/GoogleTestAdapter/Core/Runners/CommandLineGenerator.cs +++ b/GoogleTestAdapter/Core/Runners/CommandLineGenerator.cs @@ -113,7 +113,7 @@ private string JoinTestsUpToMaxLength(List testCases, int maxLength, o } string result = ""; - string nextTest = testCases[0].FullyQualifiedName; + string nextTest = testCases[0].FullyQualifiedNameWithoutNamespace; if (nextTest.Length > maxLength) { throw new Exception(String.Format(Resources.CommandLineGeneratorError, maxLength, includedTestCases.Count, nextTest.Length)); @@ -126,7 +126,7 @@ private string JoinTestsUpToMaxLength(List testCases, int maxLength, o testCases.RemoveAt(0); if (testCases.Count > 0) { - nextTest = ":" + testCases[0].FullyQualifiedName; + nextTest = ":" + testCases[0].FullyQualifiedNameWithoutNamespace; } } return result; @@ -247,7 +247,7 @@ private List GetAllMatchingTestCases(IEnumerable cases, stri private string GetTestsuiteName(TestCase testCase) { - return testCase.FullyQualifiedName.Split('.')[0]; + return testCase.FullyQualifiedNameWithoutNamespace.Split('.')[0]; } } diff --git a/GoogleTestAdapter/Core/Runners/ParallelTestRunner.cs b/GoogleTestAdapter/Core/Runners/ParallelTestRunner.cs index a18b83e93..31fd4a912 100644 --- a/GoogleTestAdapter/Core/Runners/ParallelTestRunner.cs +++ b/GoogleTestAdapter/Core/Runners/ParallelTestRunner.cs @@ -98,7 +98,7 @@ private ITestsSplitter GetTestsSplitter(TestCase[] testCasesToRun) foreach (KeyValuePair duration in durations) { if (!_schedulingAnalyzer.AddExpectedDuration(duration.Key, duration.Value)) - _logger.DebugWarning(String.Format(Resources.TestCaseInAnalyzer, duration.Key.FullyQualifiedName)); + _logger.DebugWarning(String.Format(Resources.TestCaseInAnalyzer, duration.Key.FullyQualifiedNameWithoutNamespace)); } } catch (InvalidTestDurationsException e) diff --git a/GoogleTestAdapter/Core/Runners/SequentialTestRunner.cs b/GoogleTestAdapter/Core/Runners/SequentialTestRunner.cs index 370a4cc82..78e098daa 100644 --- a/GoogleTestAdapter/Core/Runners/SequentialTestRunner.cs +++ b/GoogleTestAdapter/Core/Runners/SequentialTestRunner.cs @@ -63,7 +63,7 @@ public void RunTests(IEnumerable testCasesToRun, string baseDir, foreach (var testCase in groupedTestCases[executable]) { - var key = Path.GetFullPath(testCase.Source) + ":" + testCase.FullyQualifiedName; + var key = Path.GetFullPath(testCase.Source) + ":" + testCase.FullyQualifiedNameWithoutNamespace; ITestPropertySettings settings; // Tests with default settings are treated as not having settings and can be run together if (_settings.TestPropertySettingsContainer.TryGetSettings(key, out settings) @@ -150,7 +150,7 @@ private void RunTestsFromExecutable(string executable, string workingDir, IDicti foreach (TestResult result in results) { if (!_schedulingAnalyzer.AddActualDuration(result.TestCase, (int)result.Duration.TotalMilliseconds)) - _logger.DebugWarning(String.Format(Resources.TestCaseInAnalyzer, result.TestCase.FullyQualifiedName)); + _logger.DebugWarning(String.Format(Resources.TestCaseInAnalyzer, result.TestCase.FullyQualifiedNameWithoutNamespace)); } } } @@ -199,7 +199,7 @@ private IEnumerable TryRunTests(string executable, string workingDir arguments.TestCases.Except(streamingParser.TestResults.Select(tr => tr.TestCase)); var testResults = new TestResultCollector(_logger, _threadName) .CollectTestResults(remainingTestCases, consoleOutput, streamingParser.CrashedTestCase); - testResults = testResults.OrderBy(tr => tr.TestCase.FullyQualifiedName).ToList(); + testResults = testResults.OrderBy(tr => tr.TestCase.FullyQualifiedNameWithoutNamespace).ToList(); return testResults; } @@ -247,7 +247,7 @@ private List RunTestExecutableWithNewFramework(string executable, string foreach (TestResult result in streamingParser.TestResults) { if (!_schedulingAnalyzer.AddActualDuration(result.TestCase, (int) result.Duration.TotalMilliseconds)) - _logger.LogWarning(String.Format(Resources.AlreadyInAnalyzer, _threadName, result.TestCase.FullyQualifiedName)); + _logger.LogWarning(String.Format(Resources.AlreadyInAnalyzer, _threadName, result.TestCase.FullyQualifiedNameWithoutNamespace)); } return consoleOutput; } diff --git a/GoogleTestAdapter/Core/Runners/TestResultCollector.cs b/GoogleTestAdapter/Core/Runners/TestResultCollector.cs index b4cec9492..5a4bfb63a 100644 --- a/GoogleTestAdapter/Core/Runners/TestResultCollector.cs +++ b/GoogleTestAdapter/Core/Runners/TestResultCollector.cs @@ -35,7 +35,7 @@ public List CollectTestResults(IEnumerable testCasesRun, L crashedTestCase = consoleParser.CrashedTestCase; var remainingTestCases = arrTestCasesRun - .Where(tc => !testResults.Exists(tr => tr.TestCase.FullyQualifiedName == tc.FullyQualifiedName)) + .Where(tc => !testResults.Exists(tr => tr.TestCase.FullyQualifiedNameWithoutNamespace == tc.FullyQualifiedNameWithoutNamespace)) .ToArray(); if (crashedTestCase != null) @@ -52,7 +52,7 @@ private void CollectResultsFromConsoleOutput(StandardOutputTestResultParser cons List consoleResults = consoleParser.GetTestResults(); int nrOfCollectedTestResults = 0; foreach (TestResult testResult in consoleResults.Where( - tr => !testResults.Exists(tr2 => tr.TestCase.FullyQualifiedName == tr2.TestCase.FullyQualifiedName))) + tr => !testResults.Exists(tr2 => tr.TestCase.FullyQualifiedNameWithoutNamespace == tr2.TestCase.FullyQualifiedNameWithoutNamespace))) { testResults.Add(testResult); nrOfCollectedTestResults++; diff --git a/GoogleTestAdapter/Core/Scheduling/SchedulingAnalyzer.cs b/GoogleTestAdapter/Core/Scheduling/SchedulingAnalyzer.cs index 5b709b02b..94dd6a755 100644 --- a/GoogleTestAdapter/Core/Scheduling/SchedulingAnalyzer.cs +++ b/GoogleTestAdapter/Core/Scheduling/SchedulingAnalyzer.cs @@ -73,7 +73,7 @@ public void PrintStatisticsToDebugOutput() _logger.DebugInfo(String.Format(Resources.WorstDifferences, nrOfWorstDifferences)); for (int i = 0; i < nrOfWorstDifferences; i++) { - _logger.DebugInfo(String.Format(Resources.Results, differences[i].TestCase.FullyQualifiedName, ExpectedTestcaseDurations[differences[i].TestCase], ActualTestcaseDurations[differences[i].TestCase])); + _logger.DebugInfo(String.Format(Resources.Results, differences[i].TestCase.FullyQualifiedNameWithoutNamespace, ExpectedTestcaseDurations[differences[i].TestCase], ActualTestcaseDurations[differences[i].TestCase])); } } diff --git a/GoogleTestAdapter/Core/Scheduling/TestDurationSerializer.cs b/GoogleTestAdapter/Core/Scheduling/TestDurationSerializer.cs index 069b91519..dd39c0060 100644 --- a/GoogleTestAdapter/Core/Scheduling/TestDurationSerializer.cs +++ b/GoogleTestAdapter/Core/Scheduling/TestDurationSerializer.cs @@ -103,7 +103,7 @@ private IDictionary ReadTestDurations(string executable, List testresults foreach (TestResult testResult in testresults.Where(tr => tr.Outcome == TestOutcome.Passed || tr.Outcome == TestOutcome.Failed)) { - durations[testResult.TestCase.FullyQualifiedName] = - new TestDuration(testResult.TestCase.FullyQualifiedName, GetDuration(testResult)); + durations[testResult.TestCase.FullyQualifiedNameWithoutNamespace] = + new TestDuration(testResult.TestCase.FullyQualifiedNameWithoutNamespace, GetDuration(testResult)); } container.TestDurations.Clear(); diff --git a/GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs b/GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs index 912756bd4..db47748dd 100644 --- a/GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs +++ b/GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs @@ -87,7 +87,7 @@ public IList CreateTestCases(Action reportTestCase = null) { foreach (var testCase in suiteTestCasesPair.Value) { - testCase.Properties.Add(new TestCaseMetaDataProperty(suiteTestCasesPair.Value.Count, testCases.Count, testCase.FullyQualifiedName)); + testCase.Properties.Add(new TestCaseMetaDataProperty(suiteTestCasesPair.Value.Count, testCases.Count, testCase.FullyQualifiedNameWithoutNamespace)); } } @@ -179,7 +179,7 @@ private IList NewCreateTestcases(Action reportTestCase, List { foreach (var testCase in suiteTestCasesPair.Value) { - testCase.Properties.Add(new TestCaseMetaDataProperty(suiteTestCasesPair.Value.Count, testCases.Count, testCase.FullyQualifiedName)); + testCase.Properties.Add(new TestCaseMetaDataProperty(suiteTestCasesPair.Value.Count, testCases.Count, testCase.FullyQualifiedNameWithoutNamespace)); reportTestCase?.Invoke(testCase); } } diff --git a/GoogleTestAdapter/Core/TestResults/StandardOutputTestResultParser.cs b/GoogleTestAdapter/Core/TestResults/StandardOutputTestResultParser.cs index c3d4af2a6..bafcba29b 100644 --- a/GoogleTestAdapter/Core/TestResults/StandardOutputTestResultParser.cs +++ b/GoogleTestAdapter/Core/TestResults/StandardOutputTestResultParser.cs @@ -196,7 +196,7 @@ private TestCase FindTestcase(string qualifiedTestname) public static TestCase FindTestcase(string qualifiedTestname, IList testCasesRun) { - return testCasesRun.SingleOrDefault(tc => tc.FullyQualifiedName == qualifiedTestname); + return testCasesRun.SingleOrDefault(tc => tc.FullyQualifiedNameWithoutNamespace == qualifiedTestname); } public static bool IsRunLine(string line) diff --git a/GoogleTestAdapter/Core/TestResults/XmlTestResultParser.cs b/GoogleTestAdapter/Core/TestResults/XmlTestResultParser.cs index 70744539a..3b0bfa525 100644 --- a/GoogleTestAdapter/Core/TestResults/XmlTestResultParser.cs +++ b/GoogleTestAdapter/Core/TestResults/XmlTestResultParser.cs @@ -26,7 +26,7 @@ public XmlTestResultParser(IEnumerable testCasesRun, string xmlResultF { _logger = logger; _xmlResultFile = xmlResultFile; - _testCasesMap = testCasesRun.ToDictionary(tc => tc.FullyQualifiedName, tc => tc); + _testCasesMap = testCasesRun.ToDictionary(tc => tc.FullyQualifiedNameWithoutNamespace, tc => tc); } diff --git a/GoogleTestAdapter/TestAdapter/DataConversionExtensions.cs b/GoogleTestAdapter/TestAdapter/DataConversionExtensions.cs index ca072534c..ff2f36a4e 100644 --- a/GoogleTestAdapter/TestAdapter/DataConversionExtensions.cs +++ b/GoogleTestAdapter/TestAdapter/DataConversionExtensions.cs @@ -51,7 +51,7 @@ public static TestCase ToTestCase(this VsTestCase vsTestCase) public static VsTestCase ToVsTestCase(this TestCase testCase) { - var vsTestCase = new VsTestCase(testCase.FullyQualifiedNameWithNamespace, TestExecutor.ExecutorUri, testCase.Source) + var vsTestCase = new VsTestCase(testCase.FullyQualifiedName, TestExecutor.ExecutorUri, testCase.Source) { DisplayName = testCase.DisplayName, CodeFilePath = testCase.CodeFilePath, diff --git a/GoogleTestAdapter/TestAdapter/TestExecutor.cs b/GoogleTestAdapter/TestAdapter/TestExecutor.cs index 297ad33b9..a14e7e495 100644 --- a/GoogleTestAdapter/TestAdapter/TestExecutor.cs +++ b/GoogleTestAdapter/TestAdapter/TestExecutor.cs @@ -98,7 +98,7 @@ private void TryRunTests(IEnumerable executables, IRunContext runContext filter.Filter(allTestCasesInExecutables.Select(tc => tc.ToVsTestCase())).ToList(); ICollection testCasesToRun = allTestCasesInExecutables.Where( - tc => vsTestCasesToRun.Any(vtc => tc.FullyQualifiedNameWithNamespace == vtc.FullyQualifiedName)).ToArray(); + tc => vsTestCasesToRun.Any(vtc => tc.FullyQualifiedName == vtc.FullyQualifiedName)).ToArray(); DoRunTests(testCasesToRun, runContext, frameworkHandle); diff --git a/GoogleTestAdapter/Tests.Common/TestDataCreator.cs b/GoogleTestAdapter/Tests.Common/TestDataCreator.cs index 95e449bd0..51e518c13 100644 --- a/GoogleTestAdapter/Tests.Common/TestDataCreator.cs +++ b/GoogleTestAdapter/Tests.Common/TestDataCreator.cs @@ -64,7 +64,7 @@ public List GetTestCases(params string[] qualifiedNames) { return AllTestCasesExceptLoadTests.Where( testCase => qualifiedNames.Any( - qualifiedName => testCase.FullyQualifiedName.Contains(qualifiedName))) + qualifiedName => testCase.FullyQualifiedNameWithoutNamespace.Contains(qualifiedName))) .ToList(); } @@ -107,9 +107,9 @@ public IEnumerable CreateDummyTestCasesFull(string[] qualifiedNamesToR { foreach (var testCase in suiteTestCasePair.Value) { - if (qualifiedNamesToRun.Contains(testCase.FullyQualifiedName)) + if (qualifiedNamesToRun.Contains(testCase.FullyQualifiedNameWithoutNamespace)) { - testCase.Properties.Add(new TestCaseMetaDataProperty(suiteTestCasePair.Value.Count, allQualifiedNames.Length, testCase.FullyQualifiedName)); + testCase.Properties.Add(new TestCaseMetaDataProperty(suiteTestCasePair.Value.Count, allQualifiedNames.Length, testCase.FullyQualifiedNameWithoutNamespace)); testCases.Add(testCase); } }