diff --git a/Docs/CHANGELOG.md b/Docs/CHANGELOG.md index 26630d5..47c1bd2 100644 --- a/Docs/CHANGELOG.md +++ b/Docs/CHANGELOG.md @@ -10,4 +10,10 @@ ### Extended Features - Added `Debug` level option to `` setting and updated what is logged in the `Verbose` level. - - Improve error handling, specifically when a duplicate testname is used, the potential resulting error is logged. \ No newline at end of file + - Improve error handling, specifically when a duplicate testname is used, the potential resulting error is logged. + - Add support for reporting Fatal Error Conditions + + ### Bug fixes + + - Bug: Warnings in Sections are not displayed when there are no failures. Fixed. + - Bug: Get invalid test runner output error when Catch2 xml output produces additional text after xml report. Additional text is now ignored. diff --git a/Libraries/Catch2Interface/Catch2Interface.csproj b/Libraries/Catch2Interface/Catch2Interface.csproj index 90d87a1..e180339 100644 --- a/Libraries/Catch2Interface/Catch2Interface.csproj +++ b/Libraries/Catch2Interface/Catch2Interface.csproj @@ -43,6 +43,7 @@ + diff --git a/Libraries/Catch2Interface/Constants.cs b/Libraries/Catch2Interface/Constants.cs index 77ade6a..857a2c5 100644 --- a/Libraries/Catch2Interface/Constants.cs +++ b/Libraries/Catch2Interface/Constants.cs @@ -30,6 +30,7 @@ public static class Constants public const string NodeName_Exception = "Exception"; public const string NodeName_Expression = "Expression"; public const string NodeName_Failure = "Failure"; + public const string NodeName_FatalErrorCondition = "FatalErrorCondition"; public const string NodeName_Info = "Info"; public const string NodeName_OverallResult = "OverallResult"; public const string NodeName_OverallResults = "OverallResults"; diff --git a/Libraries/Catch2Interface/Reporter/FatalErrorCondition.cs b/Libraries/Catch2Interface/Reporter/FatalErrorCondition.cs new file mode 100644 index 0000000..d1afb8e --- /dev/null +++ b/Libraries/Catch2Interface/Reporter/FatalErrorCondition.cs @@ -0,0 +1,76 @@ +/** Basic Info ** + +Copyright: 2018 Johnny Hendriks + +Author : Johnny Hendriks +Year : 2018 +Project: VSTestAdapter for Catch2 +Licence: MIT + +Notes: None + +** Basic Info **/ + +using System; +using System.IO; +using System.Text; +using System.Xml; + +namespace Catch2Interface.Reporter +{ + + /*YAML + Class : + Description : > + This class is intended to handle the xml "FatalErrorCondition" node in a Catch2 Xml report. + */ + public class FatalErrorCondition + { + #region Properties + + public string Filename { get; private set; } + public int Line { get; private set; } = -1; + public string Message { get; private set; } + + #endregion // Properties + + #region Constructor + + public FatalErrorCondition(XmlNode node) + { + if (node.Name == Constants.NodeName_FatalErrorCondition) + { + int line; + if (int.TryParse(node.Attributes["line"].Value, out line)) + { + Line = line; + } + + Filename = node.Attributes["filename"]?.Value; + + var nodeMessage = node?.FirstChild; + if (nodeMessage != null && nodeMessage.NodeType == XmlNodeType.Text) + { + Message = nodeMessage.Value.Trim(); + } + } + } + + #endregion // Constructor + + #region Public Methods + + public string GenerateFailureInfo() + { + StringBuilder msg = new StringBuilder(); + + msg.Append($"{Path.GetFileName(Filename)} line {Line}: Failed{Environment.NewLine}"); + msg.Append($"due to a fatal error condition with message:{Environment.NewLine}"); + msg.Append($" {Message}{Environment.NewLine}"); + + return msg.ToString(); + } + + #endregion // Public Methods + } +} diff --git a/Libraries/Catch2Interface/Reporter/Section.cs b/Libraries/Catch2Interface/Reporter/Section.cs index 53fec00..969eb74 100644 --- a/Libraries/Catch2Interface/Reporter/Section.cs +++ b/Libraries/Catch2Interface/Reporter/Section.cs @@ -31,6 +31,33 @@ public class Section public string Name { get; set; } public OverallResults OverallResults { get; set; } + public bool HasFailuresOrWarnings + { + get + { + // Check for failures + if( OverallResults == null ) return false; + if( OverallResults.Failures > 0) return true; + + // Check for warnings + foreach(var child in Children) + { + switch(child) + { + case Section section: + if(section.HasFailuresOrWarnings) return true; + break; + case Warning warning: + return true; + default: + break; + } + } + + return false; + } + } + #endregion // Properties #region Constructor @@ -59,17 +86,23 @@ public Section(XmlNode node) case Constants.NodeName_Expression: Children.Add(new Expression(child)); break; + case Constants.NodeName_Failure: + Children.Add(new Failure(child)); + break; + case Constants.NodeName_FatalErrorCondition: + Children.Add(new FatalErrorCondition(child)); + break; case Constants.NodeName_Info: Children.Add(new Info(child)); break; + case Constants.NodeName_OverallResults: + OverallResults = new OverallResults(child); + break; case Constants.NodeName_Section: Children.Add(new Section(child)); break; - case Constants.NodeName_Failure: - Children.Add(new Failure(child)); - break; - case Constants.NodeName_OverallResults: - OverallResults = new OverallResults(child); + case Constants.NodeName_Warning: + Children.Add(new Warning(child)); break; default: break; diff --git a/Libraries/Catch2Interface/Reporter/TestCase.cs b/Libraries/Catch2Interface/Reporter/TestCase.cs index 99cf64d..c7e48b5 100644 --- a/Libraries/Catch2Interface/Reporter/TestCase.cs +++ b/Libraries/Catch2Interface/Reporter/TestCase.cs @@ -64,18 +64,21 @@ public TestCase(XmlNode node) case Constants.NodeName_Expression: Children.Add(new Expression(child)); break; - case Constants.NodeName_Info: - Children.Add(new Info(child)); - break; - case Constants.NodeName_Section: - Children.Add(new Section(child)); - break; case Constants.NodeName_Failure: Children.Add(new Failure(child)); break; + case Constants.NodeName_FatalErrorCondition: + Children.Add(new FatalErrorCondition(child)); + break; + case Constants.NodeName_Info: + Children.Add(new Info(child)); + break; case Constants.NodeName_OverallResult: OverallResult = new OverallResult(child); break; + case Constants.NodeName_Section: + Children.Add(new Section(child)); + break; case Constants.NodeName_Warning: Children.Add(new Warning(child)); break; diff --git a/Libraries/Catch2Interface/TestResult.cs b/Libraries/Catch2Interface/TestResult.cs index 5173470..88ec715 100644 --- a/Libraries/Catch2Interface/TestResult.cs +++ b/Libraries/Catch2Interface/TestResult.cs @@ -161,6 +161,27 @@ private void AppendFailure(Reporter.Failure failure) ResetInfo(); } + private void AppendFatalErrorCondition(Reporter.FatalErrorCondition fatal) + { + AppendToStackTrace(fatal.Filename, fatal.Line); + _msgbuilder.Append(fatal.GenerateFailureInfo()); + if (_infobuilder.Length > 0) + { + if (_infocount > 1) + { + _msgbuilder.Append($"with additional messages:{Environment.NewLine}"); + } + else + { + _msgbuilder.Append($"with additional message:{Environment.NewLine}"); + } + _msgbuilder.Append(_infobuilder.ToString()); + } + _msgbuilder.AppendLine(); + + ResetInfo(); + } + private void AppendSection(Reporter.Section section) { _msgbuilder.Append($"Start Section: {section.Name}{Environment.NewLine}"); @@ -170,9 +191,6 @@ private void AppendSection(Reporter.Section section) { switch( child ) { - case Reporter.Info info: - AppendInfo(info.Message); - break; case Reporter.Exception exception: AppendException(exception); break; @@ -182,8 +200,14 @@ private void AppendSection(Reporter.Section section) case Reporter.Failure failure: AppendFailure(failure); break; + case Reporter.FatalErrorCondition fatal: + AppendFatalErrorCondition(fatal); + break; + case Reporter.Info info: + AppendInfo(info.Message); + break; case Reporter.Section innersection: - if (innersection.OverallResults.Failures > 0) + if (innersection.HasFailuresOrWarnings) { AppendSection(innersection); } @@ -236,9 +260,6 @@ private void ExtractMessages() { switch( child ) { - case Reporter.Info info: - AppendInfo(info.Message); - break; case Reporter.Exception exception: AppendException(exception); break; @@ -248,8 +269,14 @@ private void ExtractMessages() case Reporter.Failure failure: AppendFailure(failure); break; + case Reporter.FatalErrorCondition fatal: + AppendFatalErrorCondition(fatal); + break; + case Reporter.Info info: + AppendInfo(info.Message); + break; case Reporter.Section section: - if (section.OverallResults.Failures > 0) + if (section.HasFailuresOrWarnings) { AppendSection(section); } @@ -332,11 +359,21 @@ private void ProcessXml() try { var xml = new XmlDocument(); - xml.LoadXml(_xmloutput); - - var nodeGroup = xml.SelectSingleNode("Catch/Group"); - - ExtractTestResult(nodeGroup); + // Determine the part of the xmloutput string to parse + // In some cases Catch2 output contains additional lines of output after the + // xml-output. The XmlDocument parser doesn't like this so let's make sure those + // extra lines are ignored. + var idx = _xmloutput.IndexOf(@""); // Find first occurance of + if(idx == -1) // Make sure closing tag was found + { + SetInvalidTestRunnerOutput(); + } + else + { + xml.LoadXml(_xmloutput.Substring(0,idx+8)); + var nodeGroup = xml.SelectSingleNode("Catch/Group"); + ExtractTestResult(nodeGroup); + } } catch { diff --git a/ReferenceTests/MSBuild/Projects/Catch_NoSEH/Catch_NoSEH.vcxproj b/ReferenceTests/MSBuild/Projects/Catch_NoSEH/Catch_NoSEH.vcxproj new file mode 100644 index 0000000..98b864d --- /dev/null +++ b/ReferenceTests/MSBuild/Projects/Catch_NoSEH/Catch_NoSEH.vcxproj @@ -0,0 +1,21 @@ + + + + + Catch_NoSEH + {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} + {93AAED31-C6A6-4BFE-ABED-D750C575BA10} + + + WindowsLocalDebugger + + + + CATCH_CONFIG_NO_WINDOWS_SEH;%(PreprocessorDefinitions) + + + + + + + \ No newline at end of file diff --git a/ReferenceTests/MSBuild/Projects/Catch_NoSEH/Catch_NoSEH.vcxproj.filters b/ReferenceTests/MSBuild/Projects/Catch_NoSEH/Catch_NoSEH.vcxproj.filters new file mode 100644 index 0000000..c7571b5 --- /dev/null +++ b/ReferenceTests/MSBuild/Projects/Catch_NoSEH/Catch_NoSEH.vcxproj.filters @@ -0,0 +1,19 @@ + + + + + {e9f92384-33de-4567-ac81-601cc1c65521} + + + {36abadce-429e-4b62-9e22-98a0b1ba6ed1} + + + + + Files\Catch + + + Files + + + \ No newline at end of file diff --git a/ReferenceTests/MSBuild/Projects/Catch_Testset03/Catch_Testset03.vcxproj b/ReferenceTests/MSBuild/Projects/Catch_Testset03/Catch_Testset03.vcxproj index fb6b305..2ff71a9 100644 --- a/ReferenceTests/MSBuild/Projects/Catch_Testset03/Catch_Testset03.vcxproj +++ b/ReferenceTests/MSBuild/Projects/Catch_Testset03/Catch_Testset03.vcxproj @@ -14,6 +14,7 @@ + \ No newline at end of file diff --git a/ReferenceTests/MSBuild/Projects/Catch_Testset03/Catch_Testset03.vcxproj.filters b/ReferenceTests/MSBuild/Projects/Catch_Testset03/Catch_Testset03.vcxproj.filters index 8521956..fb90958 100644 --- a/ReferenceTests/MSBuild/Projects/Catch_Testset03/Catch_Testset03.vcxproj.filters +++ b/ReferenceTests/MSBuild/Projects/Catch_Testset03/Catch_Testset03.vcxproj.filters @@ -24,5 +24,8 @@ Files + + Files + \ No newline at end of file diff --git a/ReferenceTests/ReferenceTests.sln b/ReferenceTests/ReferenceTests.sln index c1bdc63..010fbea 100644 --- a/ReferenceTests/ReferenceTests.sln +++ b/ReferenceTests/ReferenceTests.sln @@ -13,6 +13,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Catch_Dummy", "MSBuild\Proj EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Catch_Testset04", "MSBuild\Projects\Catch_Testset04\Catch_Testset04.vcxproj", "{6F30DB9F-419F-4EAC-AAFC-17C97C94DA9A}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Catch_NoSEH", "MSBuild\Projects\Catch_NoSEH\Catch_NoSEH.vcxproj", "{93AAED31-C6A6-4BFE-ABED-D750C575BA10}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -61,6 +63,14 @@ Global {6F30DB9F-419F-4EAC-AAFC-17C97C94DA9A}.Release|x64.Build.0 = Release|x64 {6F30DB9F-419F-4EAC-AAFC-17C97C94DA9A}.Release|x86.ActiveCfg = Release|Win32 {6F30DB9F-419F-4EAC-AAFC-17C97C94DA9A}.Release|x86.Build.0 = Release|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Debug|x64.ActiveCfg = Debug|x64 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Debug|x64.Build.0 = Debug|x64 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Debug|x86.ActiveCfg = Debug|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Debug|x86.Build.0 = Debug|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Release|x64.ActiveCfg = Release|x64 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Release|x64.Build.0 = Release|x64 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Release|x86.ActiveCfg = Release|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ReferenceTests/Src/Catch2/Catch_NoSEH/UT_Tests01.cpp b/ReferenceTests/Src/Catch2/Catch_NoSEH/UT_Tests01.cpp new file mode 100644 index 0000000..c0b1ea5 --- /dev/null +++ b/ReferenceTests/Src/Catch2/Catch_NoSEH/UT_Tests01.cpp @@ -0,0 +1,73 @@ +/** Basic Info ** + +Copyright: 2018 Johnny Hendriks + +Author : Johnny Hendriks +Year : 2018 +Project: VSTestAdapter for Catch2 +Licence: MIT + +Notes: None + +** Basic Info **/ + +/************ + * Includes * + ************/ + +// STL +#include + +// Catch2 +#include + + +/************** + * Start code * + **************/ + +namespace CatchTestset03 +{ + std::size_t NullDereference() + { + std::vector* pvec = nullptr; + return pvec->size(); + } + + TEST_CASE( "NoSEH.Tests01. 01f Null dereference", "[failing]" ) + { + INFO( "Root" ); + + auto size = NullDereference(); + + CHECK(size == 0); + } + + TEST_CASE( "NoSEH.Tests01. 02f Null dereference in section", "[failing]" ) + { + INFO( "Root" ); + + SECTION("Level0") + { + auto size = NullDereference(); + CHECK(size == 0); + } + } + + TEST_CASE( "NoSEH.Tests01. 03f Bad Index", "[failing]" ) + { + INFO( "Root" ); + + std::vector vec = {1,2,3,4,5}; + + CHECK(vec.size() == 5); + + int val = vec[999999]; + CHECK( val == 0 ); + } + +} // End namespace: CatchTestset03 + +/************ + * End code * + ************/ diff --git a/ReferenceTests/Src/Catch2/Catch_Testset03/UT_Tests05.cpp b/ReferenceTests/Src/Catch2/Catch_Testset03/UT_Tests05.cpp new file mode 100644 index 0000000..28b13a6 --- /dev/null +++ b/ReferenceTests/Src/Catch2/Catch_Testset03/UT_Tests05.cpp @@ -0,0 +1,73 @@ +/** Basic Info ** + +Copyright: 2018 Johnny Hendriks + +Author : Johnny Hendriks +Year : 2018 +Project: VSTestAdapter for Catch2 +Licence: MIT + +Notes: None + +** Basic Info **/ + +/************ + * Includes * + ************/ + +// STL +#include + +// Catch2 +#include + + +/************** + * Start code * + **************/ + +namespace CatchTestset03 +{ + std::size_t NullDereference() + { + std::vector* pvec = nullptr; + return pvec->size(); + } + + TEST_CASE( "Testset03.Tests05. 01f Null dereference", "[failing]" ) + { + INFO( "Root" ); + + auto size = NullDereference(); + + CHECK(size == 0); + } + + TEST_CASE( "Testset03.Tests05. 02f Null dereference in section", "[failing]" ) + { + INFO( "Root" ); + + SECTION("Level0") + { + auto size = NullDereference(); + CHECK(size == 0); + } + } + + TEST_CASE( "Testset03.Tests05. 03f Bad Index", "[failing]" ) + { + INFO( "Root" ); + + std::vector vec = {1,2,3,4,5}; + + CHECK(vec.size() == 5); + + int val = vec[999999]; + CHECK( val == 0 ); + } + +} // End namespace: CatchTestset03 + +/************ + * End code * + ************/ diff --git a/UnitTests/UT_Catch2Interface/Resources/TestStrings_TestResult.Designer.cs b/UnitTests/UT_Catch2Interface/Resources/TestStrings_TestResult.Designer.cs new file mode 100644 index 0000000..7bf4fbf --- /dev/null +++ b/UnitTests/UT_Catch2Interface/Resources/TestStrings_TestResult.Designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace UT_Catch2Interface.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class TestStrings_TestResult { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal TestStrings_TestResult() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UT_Catch2Interface.Resources.TestStrings_TestResult", typeof(TestStrings_TestResult).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8"?> + ///<Catch name="QDummy.exe"> + /// <Group name="QDummy.exe"> + /// <TestCase name="Dummy" filename="d:\dummy.cpp" line="64"> + /// <Expression success="false" filename="d:\dummy.cpp" line="64"> + /// <Original> + /// {Unknown expression after the reported line} + /// </Original> + /// <Expanded> + /// {Unknown expression after the reported line} + /// </Expanded> + /// <FatalErrorCondition filename="d:\dummy.cpp" line="64"> + /// SIGSEGV - Segm [rest of string was truncated]";. + /// + internal static string Incomplete { + get { + return ResourceManager.GetString("Incomplete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8"?> + ///<Catch name="QDummy.exe"> + /// <Group name="QDummy.exe"> + /// <TestCase name="Dummy" filename="d:\dummy.cpp" line="64"> + /// <Expression success="false" filename="d:\dummy.cpp" line="64"> + /// <Original> + /// {Unknown expression after the reported line} + /// </Original> + /// <Expanded> + /// {Unknown expression after the reported line} + /// </Expanded> + /// <FatalErrorCondition filename="d:\dummy.cpp" line="64"> + /// SIGSEGV - Segm [rest of string was truncated]";. + /// + internal static string PostXmlText { + get { + return ResourceManager.GetString("PostXmlText", resourceCulture); + } + } + } +} diff --git a/UnitTests/UT_Catch2Interface/Resources/TestStrings_TestResult.resx b/UnitTests/UT_Catch2Interface/Resources/TestStrings_TestResult.resx new file mode 100644 index 0000000..501755b --- /dev/null +++ b/UnitTests/UT_Catch2Interface/Resources/TestStrings_TestResult.resx @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + <?xml version="1.0" encoding="UTF-8"?> +<Catch name="QDummy.exe"> + <Group name="QDummy.exe"> + <TestCase name="Dummy" filename="d:\dummy.cpp" line="64"> + <Expression success="false" filename="d:\dummy.cpp" line="64"> + <Original> + {Unknown expression after the reported line} + </Original> + <Expanded> + {Unknown expression after the reported line} + </Expanded> + <FatalErrorCondition filename="d:\dummy.cpp" line="64"> + SIGSEGV - Segmentation violation signal + </FatalErrorCondition> + </Expression> + <OverallResult success="false" durationInSeconds="0.648565"/> + </TestCase> + <OverallResults successes="6" failures="1" expectedFailures="0"/> + </Group> + <OverallResults successes="6" failures="1" expectedFailures="0"/> + + + + <?xml version="1.0" encoding="UTF-8"?> +<Catch name="QDummy.exe"> + <Group name="QDummy.exe"> + <TestCase name="Dummy" filename="d:\dummy.cpp" line="64"> + <Expression success="false" filename="d:\dummy.cpp" line="64"> + <Original> + {Unknown expression after the reported line} + </Original> + <Expanded> + {Unknown expression after the reported line} + </Expanded> + <FatalErrorCondition filename="d:\dummy.cpp" line="64"> + SIGSEGV - Segmentation violation signal + </FatalErrorCondition> + </Expression> + <OverallResult success="false" durationInSeconds="0.648565"/> + </TestCase> + <OverallResults successes="6" failures="1" expectedFailures="0"/> + </Group> + <OverallResults successes="6" failures="1" expectedFailures="0"/> +</Catch> +<Expression success="false" filename="d:\dummy.cpp" line="64"> + <Original> + {Unknown expression after the reported line} + </Original> + <Expanded> + {Unknown expression after the reported line} + </Expanded> + <FatalErrorCondition filename="d:\dummy.cpp" line="64"> + SIGSEGV - Segmentation violation signal + </FatalErrorCondition> +</Expression> + + \ No newline at end of file diff --git a/UnitTests/UT_Catch2Interface/TestResultTests.cs b/UnitTests/UT_Catch2Interface/TestResultTests.cs new file mode 100644 index 0000000..d4477ab --- /dev/null +++ b/UnitTests/UT_Catch2Interface/TestResultTests.cs @@ -0,0 +1,37 @@ +using Catch2Interface; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Text; + +namespace UT_Catch2Interface +{ + /// + /// Summary description for TestResultTests + /// + [TestClass] + public class TestResultTests + { + public TestContext TestContext { get; set; } + + [TestMethod] + public void TestPostXmlText() + { + var settings = new Settings(); + var result = new Catch2Interface.TestResult(Resources.TestStrings_TestResult.PostXmlText, settings); + + Assert.IsFalse(result.Success); + Assert.IsFalse(result.ErrorMessage.Contains("Invalid test runner output.")); + } + + [TestMethod] + public void TestIncomplete() + { + var settings = new Settings(); + var result = new Catch2Interface.TestResult(Resources.TestStrings_TestResult.Incomplete, settings); + + Assert.IsFalse(result.Success); + Assert.IsTrue(result.ErrorMessage.Contains("Invalid test runner output.")); + } + } +} diff --git a/UnitTests/UT_Catch2Interface/UT_Catch2Interface.csproj b/UnitTests/UT_Catch2Interface/UT_Catch2Interface.csproj index 9d04d67..a9a452d 100644 --- a/UnitTests/UT_Catch2Interface/UT_Catch2Interface.csproj +++ b/UnitTests/UT_Catch2Interface/UT_Catch2Interface.csproj @@ -69,7 +69,13 @@ True TestStrings_Executor.resx + + True + True + TestStrings_TestResult.resx + + @@ -83,6 +89,10 @@ ResXFileCodeGenerator TestStrings_Executor.Designer.cs + + ResXFileCodeGenerator + TestStrings_TestResult.Designer.cs + diff --git a/VSIX/VSTestAdapterCatch2/source.extension.vsixmanifest b/VSIX/VSTestAdapterCatch2/source.extension.vsixmanifest index 5beb2a0..4130ea7 100644 --- a/VSIX/VSTestAdapterCatch2/source.extension.vsixmanifest +++ b/VSIX/VSTestAdapterCatch2/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Test Adapter for Catch2 Test Adapter for use with the Catch2 C++ unit test framework. https://github.com/JohnnyHendriks/TestAdapter_Catch2 diff --git a/VSTestAdapterCatch2.sln b/VSTestAdapterCatch2.sln index f250e60..f4cc0b3 100644 --- a/VSTestAdapterCatch2.sln +++ b/VSTestAdapterCatch2.sln @@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSTestAdapterCatch2", "VSIX EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Catch_Testset04", "ReferenceTests\MSBuild\Projects\Catch_Testset04\Catch_Testset04.vcxproj", "{6F30DB9F-419F-4EAC-AAFC-17C97C94DA9A}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Catch_NoSEH", "ReferenceTests\MSBuild\Projects\Catch_NoSEH\Catch_NoSEH.vcxproj", "{93AAED31-C6A6-4BFE-ABED-D750C575BA10}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -137,6 +139,16 @@ Global {6F30DB9F-419F-4EAC-AAFC-17C97C94DA9A}.Release|x64.Build.0 = Release|x64 {6F30DB9F-419F-4EAC-AAFC-17C97C94DA9A}.Release|x86.ActiveCfg = Release|Win32 {6F30DB9F-419F-4EAC-AAFC-17C97C94DA9A}.Release|x86.Build.0 = Release|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Debug|x64.ActiveCfg = Debug|x64 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Debug|x64.Build.0 = Debug|x64 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Debug|x86.ActiveCfg = Debug|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Debug|x86.Build.0 = Debug|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Release|Any CPU.ActiveCfg = Release|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Release|x64.ActiveCfg = Release|x64 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Release|x64.Build.0 = Release|x64 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Release|x86.ActiveCfg = Release|Win32 + {93AAED31-C6A6-4BFE-ABED-D750C575BA10}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -151,6 +163,7 @@ Global {30A41C70-7668-40F7-9DC3-1870F440ABB1} = {B4A54678-F45D-4252-8CDF-9D549E42797A} {289EE75E-CBB6-4179-B61C-8EED1554CFF7} = {D2773C29-88F8-4B67-9874-4534A47A9D74} {6F30DB9F-419F-4EAC-AAFC-17C97C94DA9A} = {C04B9095-2EFB-4974-88A7-D3DC051C98BF} + {93AAED31-C6A6-4BFE-ABED-D750C575BA10} = {C04B9095-2EFB-4974-88A7-D3DC051C98BF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EA93387E-2359-4A31-9AE3-693830AEC329}