Skip to content

Commit

Permalink
fixed some tests (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
csoltenborn committed Jan 16, 2017
1 parent 50ee541 commit 824897d
Show file tree
Hide file tree
Showing 23 changed files with 446 additions and 261 deletions.
37 changes: 0 additions & 37 deletions GoogleTestAdapter/Tests.Common/Resources/Trx2TestRun.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -118,43 +118,6 @@
</TestMethod>
</xsl:template>

<xsl:template match="ms:TestLists">
<TestLists>
<xsl:apply-templates />
</TestLists>
</xsl:template>

<xsl:template match="ms:TestList">
<TestList>
<xsl:attribute name="name">
<xsl:value-of select="@name" />
</xsl:attribute>
</TestList>
</xsl:template>

<!--
<xsl:template match="ms:RunInfos">
<RunInfos>
<xsl:apply-templates />
</RunInfos>
</xsl:template>
<xsl:template match="ms:RunInfo">
<RunInfo>
<xsl:attribute name="outcome">
<xsl:value-of select="@outcome" />
</xsl:attribute>
<xsl:apply-templates />
</RunInfo>
</xsl:template>
<xsl:template match="ms:Text">
<Text>
<xsl:value-of select="." />
</Text>
</xsl:template>
-->

<xsl:template match="ms:ResultSummary">
<ResultSummary>
<xsl:attribute name="outcome">
Expand Down
12 changes: 4 additions & 8 deletions GoogleTestAdapter/Tests.Common/ResultChecker/TrxResultChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ public void RunTestsAndCheckOutput(string typeName, string arguments, string tes
Assert.Inconclusive($"First time this test runs, created golden file - check for correctness! File: {goldenFile}");
}
CheckIfFileIsParsable(goldenFile);

string diffFile;
if (!CompareXmlFiles(goldenFile, transformedResultFile, out diffFile))
if (!CompareXmlFiles(goldenFile, transformedResultFile, out string diffFile))
{
if (!Directory.Exists(_diffFilesDir))
Directory.CreateDirectory(_diffFilesDir);
Expand All @@ -90,15 +88,13 @@ public void RunTestsAndCheckOutput(string typeName, string arguments, string tes

private string RunExecutableAndGetResultsFile(string arguments)
{
string command = TestResources.GetVsTestConsolePath(TestMetadata.Versions.VS2015);
string command = TestResources.GetVsTestConsolePath(TestMetadata.Versions.VS2017);
command.AsFileInfo().Should().Exist();

string workingDir = "";

var launcher = new TestProcessLauncher();
List<string> standardOut;
List<string> standardErr;
launcher.GetOutputStreams(workingDir, command, arguments, out standardOut, out standardErr);
launcher.GetOutputStreams(workingDir, command, arguments, out var standardOut, out var standardErr);

return ParseResultsFileFromOutput(standardOut);
}
Expand Down Expand Up @@ -164,7 +160,7 @@ private void CheckIfFileIsParsable(string file)

private string ParseResultsFileFromOutput(List<string> standardOut)
{
string resultsFileRegex = @"Results File: (.*)";
string resultsFileRegex = @"(?:Results File|Ergebnisdatei): (.*)";
string resultsFile = null;
foreach (string line in standardOut)
{
Expand Down
2 changes: 1 addition & 1 deletion GoogleTestAdapter/Tests.Common/TestMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public static class TestCategories
public const string Load = "Load";
}

public enum Versions { VS2012 = 11, VS2013 = 12, VS2015 = 14 }
public enum Versions { VS2012 = 11, VS2013 = 12, VS2015 = 14, VS2017 = 15 }
}
}
8 changes: 7 additions & 1 deletion GoogleTestAdapter/Tests.Common/TestResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ public static string GetGoldenFileName(string typeName, string testCaseName, str

public static string GetVsTestConsolePath(TestMetadata.Versions version)
{
return @"C:\Program Files (x86)\" + $"Microsoft Visual Studio {version:d}.0" + @"\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe";
switch (version)
{
case TestMetadata.Versions.VS2017:
return @"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe";
default:
return @"C:\Program Files (x86)\" + $"Microsoft Visual Studio {version:d}.0" + @"\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe";
}
}

public static string NormalizePointerInfo(string text)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ Expected: 1000</Message>
<TestMethod name="Crashing.TheCrash" className="Crashing" adapterTypeName="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter" codeBase="$(Directory)\SampleTests\${ConfigurationName}\CrashingTests_gta.exe" />
</UnitTest>
</TestDefinitions>
<TestLists>
<TestList name="Results Not in a List" />
<TestList name="All Loaded Results" />
</TestLists>
<ResultSummary outcome="Failed">
<Counters total="6" executed="3" passed="1" failed="2" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
<Output />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ Expected: 1000</Message>
</ErrorInfo>
</Output>
</UnitTestResult>
<UnitTestResult testName="Crashing.LongRunning" outcome="Passed" />
<UnitTestResult testName="Crashing.LongRunning" outcome="Passed">
<Output />
</UnitTestResult>
<UnitTestResult testName="Crashing.TheCrash" outcome="Failed">
<Output>
<ErrorInfo>
Expand Down Expand Up @@ -66,10 +68,6 @@ Expected: 1000</Message>
<TestMethod name="Crashing.TheCrash" className="Crashing" adapterTypeName="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter" codeBase="$(Directory)\SampleTests\${ConfigurationName}\CrashingTests_gta.exe" />
</UnitTest>
</TestDefinitions>
<TestLists>
<TestList name="Results Not in a List" />
<TestList name="All Loaded Results" />
</TestLists>
<ResultSummary outcome="Failed">
<Counters total="6" executed="4" passed="1" failed="3" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
<Output />
Expand Down
Loading

0 comments on commit 824897d

Please sign in to comment.