From 348fe083cfbc3dcbd263a191a07b0bfcd1e14360 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Mon, 29 Jul 2019 16:04:36 +0530 Subject: [PATCH 01/20] First draft for the Html Logger. --- TestPlatform.sln | 34 +- .../Friends.cs | 10 + .../Html.xslt | 257 ++++++++++ .../HtmlLogger.cs | 239 +++++++++ .../HtmlTransformer.cs | 25 + .../IHtmlTransformer.cs | 18 + ....TestPlatform.Extensions.HtmlLogger.csproj | 56 +++ .../Resources.Designer.cs | 84 ++++ .../Resources.resx | 124 +++++ .../TestResults.cs | 56 +++ .../TestRunSummary.cs | 10 + .../Testresult.cs | 29 ++ .../Utility/Constants.cs | 33 ++ .../converter.cs | 38 ++ .../html.html | 58 +++ .../sample.xml | 2 + .../HtmlLoggerTests.cs | 473 ++++++++++++++++++ ...orm.Extensions.HtmlLogger.UnitTests.csproj | 26 + 18 files changed, 1570 insertions(+), 2 deletions(-) create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Friends.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.Designer.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.resx create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/converter.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/html.html create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/sample.xml create mode 100644 test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs create mode 100644 test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj diff --git a/TestPlatform.sln b/TestPlatform.sln index 4db14778e0..fb47dab9d9 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29025.244 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.779 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED0C35EB-7F31-4841-A24F-8EB708FFA959}" EndProject @@ -172,6 +172,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SettingsMigrator.UnitTests" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscoveryTestProject", "test\TestAssets\DiscoveryTestProject\DiscoveryTestProject.csproj", "{D16ACC60-52F8-4912-8870-5733A9F6852D}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.Extensions.HtmlLogger", "src\Microsoft.TestPlatform.Extensions.HtmlLogger\Microsoft.TestPlatform.Extensions.HtmlLogger.csproj", "{236A71E3-01DA-4679-9DFF-16A8E079ACFF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests", "test\Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests\Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj", "{41248B96-6E15-4E5E-A78F-859897676814}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -866,6 +870,30 @@ Global {D16ACC60-52F8-4912-8870-5733A9F6852D}.Release|x64.Build.0 = Release|Any CPU {D16ACC60-52F8-4912-8870-5733A9F6852D}.Release|x86.ActiveCfg = Release|Any CPU {D16ACC60-52F8-4912-8870-5733A9F6852D}.Release|x86.Build.0 = Release|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Debug|x64.ActiveCfg = Debug|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Debug|x64.Build.0 = Debug|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Debug|x86.ActiveCfg = Debug|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Debug|x86.Build.0 = Debug|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Release|Any CPU.Build.0 = Release|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Release|x64.ActiveCfg = Release|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Release|x64.Build.0 = Release|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Release|x86.ActiveCfg = Release|Any CPU + {236A71E3-01DA-4679-9DFF-16A8E079ACFF}.Release|x86.Build.0 = Release|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Debug|Any CPU.Build.0 = Debug|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Debug|x64.ActiveCfg = Debug|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Debug|x64.Build.0 = Debug|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Debug|x86.ActiveCfg = Debug|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Debug|x86.Build.0 = Debug|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Release|Any CPU.ActiveCfg = Release|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Release|Any CPU.Build.0 = Release|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Release|x64.ActiveCfg = Release|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Release|x64.Build.0 = Release|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Release|x86.ActiveCfg = Release|Any CPU + {41248B96-6E15-4E5E-A78F-859897676814}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -940,6 +968,8 @@ Global {69F5FF81-5615-4F06-B83C-FCF979BB84CA} = {ED0C35EB-7F31-4841-A24F-8EB708FFA959} {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6} {D16ACC60-52F8-4912-8870-5733A9F6852D} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} + {236A71E3-01DA-4679-9DFF-16A8E079ACFF} = {5E7F18A8-F843-4C8A-AB02-4C7D9205C6CF} + {41248B96-6E15-4E5E-A78F-859897676814} = {020E15EA-731F-4667-95AF-226671E0C3AE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0541B30C-FF51-4E28-B172-83F5F3934BCD} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Friends.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Friends.cs new file mode 100644 index 0000000000..b110313624 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Friends.cs @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Runtime.CompilerServices; + +#region Test Assemblies + +[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] + +#endregion diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt new file mode 100644 index 0000000000..93e82624a4 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt @@ -0,0 +1,257 @@ + + + + + + +

TestResults

+ + + + + +
+ + +

Summary

+ + + +

Results

+ + +
+ + +

TestResult

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + +
+
+
+ + + +
+ +
+ + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + +
+
+
+ + + + ErrorMessage: + + +
+
+ + + ErrorStackTrace: + + +
+
+ + + + FailedTests: + + + + + +
+
+ + + PassedTests: + + + + +
+
+ + + TotalTests: + + + + +
+
+ + + DisplayName: + + +
+
+ + + + + + + + + + + + + + + + + + ✔ + + + + + + ✘ + + + + + Duration: + + +
+
+ + + + + + + + + +
diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs new file mode 100644 index 0000000000..edb569f3bb --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using HtmlLoggerConstants = Microsoft.TestPlatform.Extensions.HtmlLogger.Utility.Constants; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; + using System.Xml.Serialization; + using System.Xml; + using System.Runtime.Serialization; + using System.IO; + using Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger; + using System.Collections.Concurrent; + using Microsoft.VisualStudio.TestPlatform.Utilities; + using System.Globalization; + using System.Text; + using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers; + + + /// + /// Logger for generating Html log + /// + [FriendlyName(HtmlLoggerConstants.FriendlyName)] + [ExtensionUri(HtmlLoggerConstants.ExtensionUri)] + public class Htmllogger : ITestLoggerWithParameters + { + // private string htmlFilePath; + private Dictionary parametersDictionary; + private ConcurrentDictionary Results; + //private TestOutcome testRunOutcome; + internal int totalTests; + internal int failTests; + internal int passTests { get; set; } + // private string htmlFilePath; + private TestResults testResults; + internal string htmlFileName; + internal string xmlFileName; + internal IFileHelper filehelper; + + DataContractSerializer xmlSerializer; + IHtmlTransformer htmlTransformer; + + public Htmllogger() + : this(new FileHelper(), new HtmlTransformer(), new DataContractSerializer(typeof(TestResults))) + { + } + + public Htmllogger(IFileHelper filehelper, IHtmlTransformer htmlTransformer, DataContractSerializer dataContractSerializer) + { + this.filehelper = filehelper; + this.htmlTransformer = htmlTransformer; + this.xmlSerializer = dataContractSerializer; + } + + /// + /// Gets the directory under which default trx file and test results attachements should be saved. + /// + public string TestResultsDirPath { get; private set; } + public ConcurrentDictionary GetResults() { return this.Results; } + + internal TestResults GetTestResults() + { + return this.testResults; + } + + internal void SetTestResults(TestResults testresults) + { + this.testResults = testresults; + } + + public void Initialize(TestLoggerEvents events, string testResultsDirPath) + { + if (events == null) + { + throw new ArgumentNullException(nameof(events)); + } + + if (string.IsNullOrEmpty(testResultsDirPath)) + { + throw new ArgumentNullException(nameof(testResultsDirPath)); + } + + // Register for the events. + events.TestRunMessage += this.TestMessageHandler; + events.TestResult += this.TestResultHandler; + events.TestRunComplete += this.TestRunCompleteHandler; + + this.TestResultsDirPath = testResultsDirPath; + this.testResults = new TestResults(); + this.Results = new ConcurrentDictionary(); + } + + /// + public void Initialize(TestLoggerEvents events, Dictionary parameters) + { + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + if (parameters.Count == 0) + { + throw new ArgumentException("No default parameters added", nameof(parameters)); + } + + this.parametersDictionary = parameters; + this.Initialize(events, this.parametersDictionary[DefaultLoggerParameterNames.TestRunDirectory]); + } + + internal void TestMessageHandler(object sender, TestRunMessageEventArgs e) + { + ValidateArg.NotNull(sender, "sender"); + ValidateArg.NotNull(e, "e"); + + // TrxLoggerObjectModel.RunInfo runMessage; + switch (e.Level) + { + case TestMessageLevel.Informational: + testResults.RunLevelMessageInformational.Add(e.Message); + break; + case TestMessageLevel.Warning: + testResults.RunLevelMessageErrorAndWarning.Add(e.Message); + break; + case TestMessageLevel.Error: + testResults.RunLevelMessageErrorAndWarning.Add(e.Message); + break; + default: + Debug.Fail("htmlLogger.TestMessageHandler: The test message level is unrecognized: {0}", e.Level.ToString()); + break; + } + } + + internal void TestResultHandler(object sender, TestResultEventArgs e) + { + ValidateArg.NotNull(sender, "sender"); + ValidateArg.NotNull(e, "e"); + + Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.TestResult testResult = new Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.TestResult() ; + if(e.Result.DisplayName!=null) + testResult.DisplayName = e.Result.DisplayName; + else + testResult.DisplayName = e.Result.TestCase.DisplayName; + + testResult.FullyQualifiedName = e.Result.TestCase.FullyQualifiedName; + //yet to test... + testResult.Duration = e.Result.Duration; + testResult.ErrorStackTrace = e.Result.ErrorStackTrace; + testResult.ErrorMessage = e.Result.ErrorMessage; + + //yet to test.. + var executionId = Converter.GetExecutionId(e.Result); + var parentExecutionId = Converter.GetParentExecutionId(e.Result); + + this.totalTests++; + + + testResult.resultOutcome = e.Result.Outcome; + if (e.Result.Outcome == TestOutcome.Failed) + { + this.failTests++; + } + else if (e.Result.Outcome == TestOutcome.Passed) + { + this.passTests++; + } + + if(parentExecutionId==Guid.Empty) + testResults.Results.Add(testResult); + + Results.TryAdd(executionId, testResult); + if(parentExecutionId!= Guid.Empty) + { + this.AddToParentResult(executionId,parentExecutionId,testResult); + } + } + + internal void AddToParentResult(Guid executionId,Guid parentExecutionId ,TestResult testResult) + { + TestResult ParentTestResult; + this.Results.TryGetValue(parentExecutionId, out ParentTestResult); + if (ParentTestResult.innerTestResults == null) + ParentTestResult.innerTestResults = new List(); + ParentTestResult.innerTestResults.Add(testResult); + + } + + + internal void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) + { + testResults.Summary = new TestRunSummary + { + FailedTests = this.failTests, + PassedTests = this.passTests, + TotalTests = this.totalTests + }; + //var list = new List(); + //list.Add(new TestResult(new TestCase("abc", new Uri("executor://dummy"), "abc.dll"))); + this.PopulateHtmlFile(); + } + + private void PopulateHtmlFile() + { + var xmlFilePath = GetXmlFilePath(); + Stream xmlStream = this.filehelper.GetStream(xmlFilePath, FileMode.Create); + + var htmlFilePath = GetHtmlFilePath(); + xmlSerializer.WriteObject(xmlStream, testResults); + xmlStream.Close(); + + htmlTransformer.Transform(xmlFilePath, htmlFilePath); + } + + private string GetHtmlFilePath() + { + this.htmlFileName = GetFileName("html"); + var htmlFilePath = Path.Combine(this.TestResultsDirPath, htmlFileName); + return htmlFilePath; + } + + private string GetXmlFilePath() + { + this.xmlFileName = GetFileName("xml"); + var xmlFilePath = Path.Combine(this.TestResultsDirPath, xmlFileName); + return xmlFilePath; + } + + private string GetFileName(string fileFormat) + { + var fullfileformat = string.Concat("." +fileFormat); + return string.Concat("TestResult_", DateTime.Now.ToLongDateString(), fullfileformat); + } + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs new file mode 100644 index 0000000000..bb3e16d963 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.Xsl; +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +{ + class HtmlTransformer : IHtmlTransformer + { + StringReader xsltStringReader = new StringReader(Resources.Html); + XslCompiledTransform myXslTransform; + + public HtmlTransformer() + { + myXslTransform = new XslCompiledTransform(); + myXslTransform.Load(XmlReader.Create(xsltStringReader)); + } + + public void Transform(string xmlfile,string htmlfile) + { + myXslTransform.Transform(xmlfile, htmlfile); + } + } +} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs new file mode 100644 index 0000000000..5f12d4b52e --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +{ + /// + /// + /// + public interface IHtmlTransformer + { + /// + /// + /// + /// + /// + void Transform(string xmlfile, string htmlfile); + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj new file mode 100644 index 0000000000..4cba3b64f1 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj @@ -0,0 +1,56 @@ + + + + ..\..\ + + + + Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger + true + netstandard2.0;net451 + netstandard2.0 + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + True + True + Resources.resx + + + + + Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger + + + diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.Designer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.Designer.cs new file mode 100644 index 0000000000..6d3930e635 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.Designer.cs @@ -0,0 +1,84 @@ +//------------------------------------------------------------------------------ +// +// 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 Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { + 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 Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 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("Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.Resources", typeof(Resources).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"?> + ///<xsl:stylesheet version="2.0" + /// + /// xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + /// xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + /// xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp" + ///> + /// <xsl:output method="html" indent="yes"/> + /// <xsl:template match="/"> + /// <html> + /// <body> + /// <h1>TestResults</h1> + /// <xsl:apply-templates [rest of string was truncated]";. + /// + internal static string Html { + get { + return ResourceManager.GetString("Html", resourceCulture); + } + } + } +} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.resx b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.resx new file mode 100644 index 0000000000..5f8e39a864 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + Html.xslt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs new file mode 100644 index 0000000000..b87e59f942 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Text; +using Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger; + +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +{ + [DataContract] + [KnownType(typeof(TestResult))] + public sealed class TestResults + { + /// + /// + /// + public TestResults() + { + } + + /// + /// + /// + [DataMember] + internal TestRunSummary Summary { get; set; } + + /// + /// + /// + [DataMember] + internal List RunLevelMessageInformational = new List(); + + /// + /// + /// + [DataMember] + internal List RunLevelMessageErrorAndWarning = new List(); + + /// + /// + /// + [DataMember] + internal List Results = new List(); + + + + /// + /// + /// + /// + internal int GetTestResultscount() + { + return this.Results.Count; + } + + } +} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs new file mode 100644 index 0000000000..a92a64e98f --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs @@ -0,0 +1,10 @@ +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +{ + public class TestRunSummary + { + public int TotalTests { get; set; } + public int PassedTests { get; set; } + public int FailedTests { get; set; } + public int SkippedTests { get; set; } + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs new file mode 100644 index 0000000000..1f43a91a41 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs @@ -0,0 +1,29 @@ +using Microsoft.VisualStudio.TestPlatform.ObjectModel; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +{ + + public class TestResult + { + public string FullyQualifiedName; + public string DisplayName; + public string ErrorStackTrace; + public string ErrorMessage; + public TestOutcome resultOutcome; + + + public TimeSpan Duration { get; set; } + public List innerTestResults; + internal int GetInnerTestResultscount() + { + return this.innerTestResults.Count; + } + internal TestResult GetTestResult() + { + return this; + } + } +} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs new file mode 100644 index 0000000000..42fd482cb3 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs @@ -0,0 +1,33 @@ +namespace Microsoft.TestPlatform.Extensions.HtmlLogger.Utility +{ + using System; + // using Microsoft.TestPlatform.Extensions.HtmlLogger.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + + internal static class Constants + { + /// + /// Uri used to uniquely identify the TRX logger. + /// + public const string ExtensionUri = "logger://Microsoft/TestPlatform/HtmlLogger/v1"; + + /// + /// Alternate user friendly string to uniquely identify the console logger. + /// + public const string FriendlyName = "Html"; + public const string TestTypePropertyIdentifier = "TestType"; + public static readonly Guid OrderedTestTypeGuid = new Guid("ec4800e8-40e5-4ab3-8510-b8bf29b1904d"); + + public const string ParentExecutionIdPropertyIdentifier = "ParentExecId"; + public const string ExecutionIdPropertyIdentifier = "ExecutionId"; + public const string LogFileNameKey = "LogFileName"; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] + public static readonly TestProperty ExecutionIdProperty = TestProperty.Register("ExecutionId", ExecutionIdPropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(VisualStudio.TestPlatform.ObjectModel.TestResult)); + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] + public static readonly TestProperty ParentExecIdProperty = TestProperty.Register("ParentExecId", ParentExecutionIdPropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(VisualStudio.TestPlatform.ObjectModel.TestResult)); + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] + public static readonly TestProperty TestTypeProperty = TestProperty.Register("TestType", TestTypePropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(VisualStudio.TestPlatform.ObjectModel.TestResult)); + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/converter.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/converter.cs new file mode 100644 index 0000000000..33a453d571 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/converter.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestPlatform.ObjectModel; +using Microsoft.TestPlatform.Extensions.HtmlLogger.Utility; +using Constants = Microsoft.TestPlatform.Extensions.HtmlLogger.Utility.Constants; + +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +{ + class Converter + { + public static Guid GetParentExecutionId(ObjectModel.TestResult testResult) + { + TestProperty parentExecutionIdProperty = testResult.Properties.FirstOrDefault( + property => property.Id.Equals(Constants.ParentExecutionIdPropertyIdentifier)); + + return parentExecutionIdProperty == null ? + Guid.Empty : + testResult.GetPropertyValue(parentExecutionIdProperty, Guid.Empty); + } + + + public static Guid GetExecutionId(ObjectModel.TestResult testResult) + { + TestProperty executionIdProperty = testResult.Properties.FirstOrDefault( + property => property.Id.Equals(Constants.ExecutionIdPropertyIdentifier)); + + var executionId = Guid.Empty; + if (executionIdProperty != null) + executionId = testResult.GetPropertyValue(executionIdProperty, Guid.Empty); + + return executionId.Equals(Guid.Empty) ? Guid.NewGuid() : executionId; + } + } + + +} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/html.html b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/html.html new file mode 100644 index 0000000000..248702c5db --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/html.html @@ -0,0 +1,58 @@ + + +

TestResults

+

Summary

+ TotalTests: + 6
+ FailedTests: + 2
+ PassedTests: + 4

Results

+

TestResult

+
+
PassedUnitTestProject3.UnitTest1.TestMethod1
+ Duration:PT0.0058002S
+

+ +
+
PassedUnitTestProject3.UnitTest2.TestMethod1
+ Duration:PT0.000227S
+

+
+
PassedUnitTestProject3.UnitTest2.TestMethod2
+ Duration:PT0.0000478S
+

+ + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/sample.xml b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/sample.xml new file mode 100644 index 0000000000..19165bd29a --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/sample.xml @@ -0,0 +1,2 @@ +TestMethod1PT0.0058002SUnitTestProject3.UnitTest1.TestMethod1PassedTestMethod2PT1.288131SUnitTestProject3.UnitTest1.TestMethod2Sequential numbersPT1.2875673SAssert.AreEqual failed. Expected:<5>. Actual:<4>. at UnitTestProject3.UnitTest1.TestMethod2(Int32 a, Int32 b) in C:\Users\havineet\source\repos\UnitTestProject3\UnitTestProject3\UnitTest1.cs:line 19 +UnitTestProject3.UnitTest1.TestMethod2Failedequal numbersPT0.0000059SUnitTestProject3.UnitTest1.TestMethod2PassedFailedTestMethod1PT0.000227SUnitTestProject3.UnitTest2.TestMethod1PassedTestMethod2PT0.0000478SUnitTestProject3.UnitTest2.TestMethod2Passed246 \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs new file mode 100644 index 0000000000..ebb4ecd84f --- /dev/null +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs @@ -0,0 +1,473 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests +{ + using System; + using System.Collections.Generic; + using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using ObjectModel = VisualStudio.TestPlatform.ObjectModel; + using VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger; + using HtmlLoggerConstants = Microsoft.TestPlatform.Extensions.HtmlLogger.Utility.Constants; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; + using HtmlLogger = VisualStudio.TestPlatform.Extensions.HtmlLogger; + using System.Text; + using System.Collections.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using System.Linq; + using System.Xml; + using System.Xml.Linq; + using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; + + [TestClass] + public class HtmlLoggerTests + { + private Mock events; + private Htmllogger htmlLogger; + private Dictionary parameters; + private static string DefaultTestRunDirectory = Path.GetTempPath(); + private static string DefaultLogFileNameParameterValue = "logfilevalue.trx"; + private Mock mockFileHelper; + + [TestInitialize] + public void Initialize() + { + this.events = new Mock(); + this.htmlLogger = new Htmllogger(); + this.parameters = new Dictionary(2); + this.parameters[ObjectModel.DefaultLoggerParameterNames.TestRunDirectory] = HtmlLoggerTests.DefaultTestRunDirectory; + this.parameters[HtmlLoggerConstants.LogFileNameKey] = HtmlLoggerTests.DefaultLogFileNameParameterValue; + this.htmlLogger.Initialize(this.events.Object, this.parameters); + + + } + [TestMethod] + public void InitializeShouldThrowExceptionIfEventsIsNull() + { + Assert.ThrowsException( + () => + { + this.htmlLogger.Initialize(null, this.parameters); + }); + } + + [TestMethod] + public void InitializeShouldInitializeAllProperties() + { + var testResultDir = @"C:\Code\abc"; + var events = new Mock(); + + this.htmlLogger.Initialize(events.Object, testResultDir); + + Assert.AreEqual(this.htmlLogger.TestResultsDirPath, testResultDir); + Assert.IsNotNull(this.htmlLogger.GetTestResults()); + + Assert.IsNotNull(this.htmlLogger.GetResults()); + } + + + + [TestMethod] + public void InitializeShouldThrowExceptionIfTestRunDirectoryIsEmptyOrNull() + { + Assert.ThrowsException( + () => + { + this.events = new Mock(); + this.parameters[ObjectModel.DefaultLoggerParameterNames.TestRunDirectory] = null; + this.htmlLogger.Initialize(events.Object, parameters); + }); + } + + + [TestMethod] + public void InitializeShouldThrowExceptionIfParametersAreEmpty() + { + var events = new Mock(); + Assert.ThrowsException(() => this.htmlLogger.Initialize(events.Object, new Dictionary())); + } + + [TestMethod] + public void TestMessageHandlerShouldThrowExceptionIfEventArgsIsNull() + { + Assert.ThrowsException(() => + { + this.htmlLogger.TestMessageHandler(new object(), default(TestRunMessageEventArgs)); + }); + } + + [TestMethod] + public void TestMessageHandlerShouldAddMessageWhenItIsInformation() + { + string message = "First message"; + + TestRunMessageEventArgs trme = new TestRunMessageEventArgs(TestMessageLevel.Informational, message); + HtmlLogger.TestResults testResults = this.CreateTestResults(); + this.htmlLogger.SetTestResults(testResults); + this.htmlLogger.TestMessageHandler(new object(), trme); + + string actualMessage = this.htmlLogger.GetTestResults().RunLevelMessageInformational.First(); + Assert.AreEqual(message, actualMessage.ToString()); + + } + + [TestMethod] + public void TestMessageHandlerShouldAddMessageInListIfItIsWarningAndError() + { + string message = "error message"; + string message2 = "warning message"; + + HtmlLogger.TestResults testResults = this.CreateTestResults(); + this.htmlLogger.SetTestResults(testResults); + + TestRunMessageEventArgs trme = new TestRunMessageEventArgs(TestMessageLevel.Error, message); + this.htmlLogger.TestMessageHandler(new object(), trme); + TestRunMessageEventArgs trme2 = new TestRunMessageEventArgs(TestMessageLevel.Warning, message2); + this.htmlLogger.TestMessageHandler(new object(), trme2); + + + + Assert.AreEqual(message, this.htmlLogger.GetTestResults().RunLevelMessageErrorAndWarning.First()); + Assert.AreEqual(2, this.htmlLogger.GetTestResults().RunLevelMessageErrorAndWarning.Count()); + } + + + + [TestMethod] + public void TestResultHandlerShouldKeepTrackofSummary() + { + ObjectModel.TestCase passTestCase1 = CreateTestCase("Pass1"); + ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass2"); + ObjectModel.TestCase failTestCase1 = CreateTestCase("Fail1"); + ObjectModel.TestCase skipTestCase1 = CreateTestCase("Skip1"); + + ObjectModel.TestResult passResult1 = new ObjectModel.TestResult(passTestCase1); + passResult1.Outcome = ObjectModel.TestOutcome.Passed; + + ObjectModel.TestResult passResult2 = new ObjectModel.TestResult(passTestCase2); + passResult2.Outcome = ObjectModel.TestOutcome.Passed; + + ObjectModel.TestResult failResult1 = new ObjectModel.TestResult(failTestCase1); + failResult1.Outcome = ObjectModel.TestOutcome.Failed; + + ObjectModel.TestResult skipResult1 = new ObjectModel.TestResult(skipTestCase1); + skipResult1.Outcome = ObjectModel.TestOutcome.Skipped; + + Mock pass1 = new Mock(passResult1); + Mock pass2 = new Mock(passResult2); + Mock fail1 = new Mock(failResult1); + Mock skip1 = new Mock(skipResult1); + + + this.htmlLogger.TestResultHandler(new object(), pass1.Object); + this.htmlLogger.TestResultHandler(new object(), pass2.Object); + this.htmlLogger.TestResultHandler(new object(), fail1.Object); + this.htmlLogger.TestResultHandler(new object(), skip1.Object); + + Assert.AreEqual(this.htmlLogger.passTests, 2, "Passed Tests"); + Assert.AreEqual(this.htmlLogger.failTests, 1, "Failed Tests"); + Assert.AreEqual(this.htmlLogger.totalTests, 4, "Total Tests"); + + } + + [TestMethod] + public void TestResultHandlerShouldCreateDisplayNameIfNullProperly() + { + //this assert is for checking result dispalyname equals to null + ObjectModel.TestCase passTestCase1 = CreateTestCase("Pass1"); + ObjectModel.TestResult PassTestResultExpected = new ObjectModel.TestResult(passTestCase1); + PassTestResultExpected.DisplayName = null; + PassTestResultExpected.TestCase.DisplayName = "abc"; + + + Mock pass1 = new Mock(PassTestResultExpected); + this.htmlLogger.TestResultHandler(new object(), pass1.Object); + + HtmlLogger.TestResult passTestResultActual = new HtmlLogger.TestResult(); + + passTestResultActual.resultOutcome = TestOutcome.Passed; + passTestResultActual.DisplayName = "abc"; + + Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.GetTestResults().Results.First().DisplayName); + // Assert.AreEqual( passTestResultActual,this.htmlLogger.GetTestResults().Results.First()); + + //this assert is for checking result dispalyname equals to notnull + + ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass1"); + ObjectModel.TestResult PassTestResultExpected1 = new ObjectModel.TestResult(passTestCase1); + PassTestResultExpected.DisplayName = "def"; + PassTestResultExpected.TestCase.DisplayName = "abc"; + + Mock pass2= new Mock(PassTestResultExpected); + this.htmlLogger.TestResultHandler(new object(), pass1.Object); + + HtmlLogger.TestResult passTestResultActual1 = new HtmlLogger.TestResult(); + passTestResultActual.resultOutcome = TestOutcome.Passed; + passTestResultActual.DisplayName = "def"; + + Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.GetTestResults().Results.Last().DisplayName); + // Assert.AreEqual(passTestResultActual1, this.htmlLogger.GetTestResults().Results.First()); + + + } + + [TestMethod] + public void TestResultHandlerShouldCreateDisplayNameIfNotNullProperly() + { + + //this assert is for checking result dispalyname equals to notnull + + ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass1"); + ObjectModel.TestResult PassTestResultExpected1 = new ObjectModel.TestResult(passTestCase2); + PassTestResultExpected1.DisplayName = "def"; + PassTestResultExpected1.TestCase.DisplayName = "abc"; + + Mock pass2 = new Mock(PassTestResultExpected1); + this.htmlLogger.TestResultHandler(new object(), pass2.Object); + + HtmlLogger.TestResult passTestResultActual1 = new HtmlLogger.TestResult(); + passTestResultActual1.resultOutcome = TestOutcome.Passed; + passTestResultActual1.DisplayName = "def"; + + + Assert.AreEqual(passTestResultActual1, this.htmlLogger.GetTestResults().Results.First()); + + } + + [TestMethod] + public void TestResultHandlerShouldCreateTestResultProperly() + { + + //this assert is for checking result dispalyname equals to notnull + + ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass1"); + passTestCase2.DisplayName = "abc"; + passTestCase2.FullyQualifiedName = "fully"; + + ObjectModel.TestResult PassTestResultExpected1 = new ObjectModel.TestResult(passTestCase2) + { + DisplayName = "def", + ErrorMessage = "error message", + ErrorStackTrace = "Error strack trace" + }; + + + Mock eventArg = new Mock(PassTestResultExpected1); + + this.htmlLogger.TestResultHandler(new object(), eventArg.Object); + + var result = this.htmlLogger.GetTestResults().Results.First(); + + Assert.AreEqual(result.Duration, ""); + Assert.AreEqual(result.Duration, ""); + Assert.AreEqual(result.Duration, ""); + Assert.AreEqual(result.Duration, ""); + Assert.AreEqual(result.Duration, ""); + + } + + + + private HtmlLogger.TestResult CreateTestResult(ObjectModel.TestOutcome testoutcome,string displayName) + { + + HtmlLogger.TestResult testResult = new HtmlLogger.TestResult(); + testResult.resultOutcome = testoutcome; + testResult.DisplayName = displayName; + return testResult; + } + + [TestMethod] + public void TestResultHandlerShouldCreateOneTestEntryForEachTestCase() + { + ObjectModel.TestCase testCase1 = CreateTestCase("TestCase1"); + ObjectModel.TestCase testCase2 = CreateTestCase("TestCase2"); + + HtmlLogger.TestResults testResults = this.CreateTestResults(); + this.htmlLogger.SetTestResults(testResults); + + ObjectModel.TestResult result1 = new ObjectModel.TestResult(testCase1); + result1.Outcome = ObjectModel.TestOutcome.Failed; + + ObjectModel.TestResult result2 = new ObjectModel.TestResult(testCase2); + result2.Outcome = ObjectModel.TestOutcome.Passed; + + Mock resultEventArg1 = new Mock(result1); + Mock resultEventArg2 = new Mock(result2); + + this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); + this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); + + Assert.AreEqual(this.htmlLogger.GetTestResults().GetTestResultscount(), 2, "TestResultHandler is not creating test result entry for each test case"); + } + + [TestMethod] + public void TestResultHandlerShouldAddHierarchicalResultsForOrderedTest() + { + ObjectModel.TestCase testCase1 = CreateTestCase("TestCase1"); + ObjectModel.TestCase testCase2 = CreateTestCase("TestCase2"); + ObjectModel.TestCase testCase3 = CreateTestCase("TestCase3"); + + Guid parentExecutionId = Guid.NewGuid(); + + ObjectModel.TestResult result1 = new ObjectModel.TestResult(testCase1); + result1.SetPropertyValue(HtmlLoggerConstants.ExecutionIdProperty, parentExecutionId); + result1.SetPropertyValue(HtmlLoggerConstants.TestTypeProperty, HtmlLoggerConstants.OrderedTestTypeGuid); + + ObjectModel.TestResult result2 = new ObjectModel.TestResult(testCase2); + result2.SetPropertyValue(HtmlLoggerConstants.ExecutionIdProperty, Guid.NewGuid()); + result2.SetPropertyValue(HtmlLoggerConstants.ParentExecIdProperty, parentExecutionId); + + ObjectModel.TestResult result3 = new ObjectModel.TestResult(testCase3); + result3.Outcome = ObjectModel.TestOutcome.Failed; + result3.SetPropertyValue(HtmlLoggerConstants.ExecutionIdProperty, Guid.NewGuid()); + result3.SetPropertyValue(HtmlLoggerConstants.ParentExecIdProperty, parentExecutionId); + + Mock resultEventArg1 = new Mock(result1); + Mock resultEventArg2 = new Mock(result2); + Mock resultEventArg3 = new Mock(result3); + + this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); + this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); + this.htmlLogger.TestResultHandler(new object(), resultEventArg3.Object); + + Assert.AreEqual(this.htmlLogger.GetTestResults().GetTestResultscount(), 1, "testhandler is adding parent result correctly"); + Assert.AreEqual(this.htmlLogger.GetTestResults().Results[0].GetInnerTestResultscount(), 2, "testhandler is adding child result correctly"); + + + } + + [TestMethod] + public void TestCompleteHandlerShouldKeepTackOfSummary() + { + ObjectModel.TestCase passTestCase1 = CreateTestCase("Pass1"); + ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass2"); + ObjectModel.TestCase failTestCase1 = CreateTestCase("Fail1"); + ObjectModel.TestCase skipTestCase1 = CreateTestCase("Skip1"); + + HtmlLogger.TestResults testResults = this.CreateTestResults(); + this.htmlLogger.SetTestResults(testResults); + + ObjectModel.TestResult passResult1 = new ObjectModel.TestResult(passTestCase1); + passResult1.Outcome = ObjectModel.TestOutcome.Passed; + + ObjectModel.TestResult passResult2 = new ObjectModel.TestResult(passTestCase2); + passResult2.Outcome = ObjectModel.TestOutcome.Passed; + + ObjectModel.TestResult failResult1 = new ObjectModel.TestResult(failTestCase1); + failResult1.Outcome = ObjectModel.TestOutcome.Failed; + + ObjectModel.TestResult skipResult1 = new ObjectModel.TestResult(skipTestCase1); + skipResult1.Outcome = ObjectModel.TestOutcome.Skipped; + + Mock pass1 = new Mock(passResult1); + Mock pass2 = new Mock(passResult2); + Mock fail1 = new Mock(failResult1); + Mock skip1 = new Mock(skipResult1); + + + this.htmlLogger.TestResultHandler(new object(), pass1.Object); + this.htmlLogger.TestResultHandler(new object(), pass2.Object); + this.htmlLogger.TestResultHandler(new object(), fail1.Object); + this.htmlLogger.TestResultHandler(new object(), skip1.Object); + + this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); + + Assert.AreEqual(this.htmlLogger.GetTestResults().Summary.TotalTests, 4, "summary should keep track of totaltests"); + Assert.AreEqual(this.htmlLogger.GetTestResults().Summary.FailedTests, 1, "summary should keep track of failedtests"); + Assert.AreEqual(this.htmlLogger.GetTestResults().Summary.PassedTests, 2, "summary should keep track of passedtests"); + } + + [TestMethod] + public void TestRunInformationShouldContainUtcDateTime() + { + HtmlLogger.TestResults testResults = this.CreateTestResults(); + this.htmlLogger.SetTestResults(testResults); + this.MakeTestRunComplete(); + + + this.ValidateDateTimeInTrx(this.htmlLogger.htmlFileName,"should handle htmlfilename time to meet bounds of utc"); + this.ValidateDateTimeInTrx(this.htmlLogger.xmlFileName, "should handle xmlfilename time to meet bounds of utc"); + } + + private void ValidateDateTimeInTrx(string htmlFileName,string error) + { + this.mockFileHelper = new Mock(); + this.mockFileHelper.Verify(x => x.WriteAllTextToFile(htmlFileName, It.IsAny()), Times.Once); + + //using (FileStream file = File.OpenRead(htmlFileName)) + //{ + // using (XmlReader reader = XmlReader.Create(htmlFileName)) + // { + // XDocument document = XDocument.Load(htmlFileName); + // var timesNode = document.Descendants(document.Root.GetDefaultNamespace() + "Times").FirstOrDefault(); + // ValidateTimeWithinUtcLimits(DateTimeOffset.Parse(timesNode.Attributes("creation").FirstOrDefault().Value),error); + // ValidateTimeWithinUtcLimits(DateTimeOffset.Parse(timesNode.Attributes("start").FirstOrDefault().Value),error); + // var resultNode = document.Descendants(document.Root.GetDefaultNamespace() + "UnitTestResult").FirstOrDefault(); + // ValidateTimeWithinUtcLimits(DateTimeOffset.Parse(resultNode.Attributes("endTime").FirstOrDefault().Value),error); + // ValidateTimeWithinUtcLimits(DateTimeOffset.Parse(resultNode.Attributes("startTime").FirstOrDefault().Value),error); + // } + //} + } + + private void ValidateTimeWithinUtcLimits(DateTimeOffset dateTime,string error) + { + Assert.IsTrue(dateTime.UtcDateTime.Subtract(DateTime.UtcNow) < new TimeSpan(0, 0, 0, 60),error); + } + + private HtmlLogger.TestResults CreateTestResults() + { + HtmlLogger.TestResults testresults = new HtmlLogger.TestResults(); + //testresults.Summary.PassedTests = 1; + return testresults; + } + + private static TestCase CreateTestCase(string testCaseName) + { + return new ObjectModel.TestCase(testCaseName, new Uri("some://uri"), "DummySourceFileName"); + } + + private static TestRunCompleteEventArgs CreateTestRunCompleteEventArgs() + { + var testRunCompleteEventArgs = new TestRunCompleteEventArgs(null, false, false, null, + new Collection(), new TimeSpan(1, 0, 0, 0)); + return testRunCompleteEventArgs; + } + + private static Mock CreatePassTestResultEventArgsMock(string testCaseName = "Pass1", List testResultMessages = null) + { + TestCase passTestCase = CreateTestCase(testCaseName); + var passResult = new ObjectModel.TestResult(passTestCase); + + if (testResultMessages != null && testResultMessages.Any()) + { + foreach (var message in testResultMessages) + { + passResult.Messages.Add(message); + } + } + + return new Mock(passResult); + } + + private void MakeTestRunComplete() + { + var pass = HtmlLoggerTests.CreatePassTestResultEventArgsMock(); + this.htmlLogger.TestResultHandler(new object(), pass.Object); + var testRunCompleteEventArgs = HtmlLoggerTests.CreateTestRunCompleteEventArgs(); + this.htmlLogger.TestRunCompleteHandler(new object(), testRunCompleteEventArgs); + } + + + } + +} + + + + + + diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj new file mode 100644 index 0000000000..621dc40853 --- /dev/null +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj @@ -0,0 +1,26 @@ + + + + ..\..\ + true + true + true + + + + Exe + netcoreapp2.1;net451 + + + + + + + + + + + + + + From 56091eb99c81cf92976c1b12ec6fa3345a87de4b Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Mon, 29 Jul 2019 16:05:42 +0530 Subject: [PATCH 02/20] Adding the Program.cs for making the unit tests project build --- .../Program.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Program.cs diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Program.cs b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Program.cs new file mode 100644 index 0000000000..d674656dd0 --- /dev/null +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Program.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests +{ + public static class Program + { + public static void Main(string[] args) + { + } + } +} From a5fe993775723d43a72deb91d421aa3411bd3a9f Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Tue, 30 Jul 2019 19:51:49 +0530 Subject: [PATCH 03/20] 1. Added docs for methods 2. Added remaining unit tests 3. Removed redundant spaces. --- .../Html.xslt | 83 +---- .../HtmlLogger.cs | 260 +++++++++----- .../HtmlTransformer.cs | 12 +- .../IHtmlTransformer.cs | 5 +- .../TestResults.cs | 21 +- .../TestRunSummary.cs | 19 +- .../Testresult.cs | 46 ++- .../Utility/Constants.cs | 30 +- .../converter.cs | 38 --- .../HtmlLoggerTests.cs | 316 +++++++++--------- 10 files changed, 425 insertions(+), 405 deletions(-) delete mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/converter.cs diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt index 93e82624a4..ecd3fc7e2a 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt @@ -3,8 +3,7 @@ xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp" -> + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -37,12 +36,9 @@

Summary

- -

Results

-
@@ -51,128 +47,71 @@ - - - - - - - - - -
-
-
-
- - - - - - - -
- - ErrorMessage:
- ErrorStackTrace:
- FailedTests: @@ -180,7 +119,6 @@ -
@@ -201,16 +139,13 @@
- DisplayName:
- - @@ -220,38 +155,26 @@ - - - - - Duration: +
- - - - diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs index edb569f3bb..0e16107e6e 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs @@ -10,18 +10,13 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using HtmlLoggerConstants = Microsoft.TestPlatform.Extensions.HtmlLogger.Utility.Constants; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; - using System.Xml.Serialization; - using System.Xml; using System.Runtime.Serialization; using System.IO; - using Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger; using System.Collections.Concurrent; - using Microsoft.VisualStudio.TestPlatform.Utilities; - using System.Globalization; - using System.Text; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers; - + using System.Linq; + using System.Globalization; /// /// Logger for generating Html log @@ -30,60 +25,72 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger [ExtensionUri(HtmlLoggerConstants.ExtensionUri)] public class Htmllogger : ITestLoggerWithParameters { - // private string htmlFilePath; - private Dictionary parametersDictionary; - private ConcurrentDictionary Results; - //private TestOutcome testRunOutcome; - internal int totalTests; - internal int failTests; - internal int passTests { get; set; } - // private string htmlFilePath; - private TestResults testResults; - internal string htmlFileName; - internal string xmlFileName; - internal IFileHelper filehelper; - - DataContractSerializer xmlSerializer; - IHtmlTransformer htmlTransformer; + private IFileHelper filehelper; + private XmlObjectSerializer xmlSerializer; + private IHtmlTransformer htmlTransformer; public Htmllogger() - : this(new FileHelper(), new HtmlTransformer(), new DataContractSerializer(typeof(TestResults))) - { - } + : this(new FileHelper(), new HtmlTransformer(), new DataContractSerializer(typeof(TestResults))) + { + } - public Htmllogger(IFileHelper filehelper, IHtmlTransformer htmlTransformer, DataContractSerializer dataContractSerializer) + public Htmllogger(IFileHelper filehelper, IHtmlTransformer htmlTransformer, XmlObjectSerializer dataContractSerializer) { this.filehelper = filehelper; this.htmlTransformer = htmlTransformer; this.xmlSerializer = dataContractSerializer; } - + + public string FilePath { get; private set; } /// - /// Gets the directory under which default trx file and test results attachements should be saved. + /// Gets the directory under which default html file and test results attachements should be saved. /// public string TestResultsDirPath { get; private set; } - public ConcurrentDictionary GetResults() { return this.Results; } - internal TestResults GetTestResults() - { - return this.testResults; - } + /// + /// Total Results are stored in sequential order + /// + /// + public ConcurrentDictionary Results { get; private set; } - internal void SetTestResults(TestResults testresults) - { - this.testResults = testresults; - } - - public void Initialize(TestLoggerEvents events, string testResultsDirPath) + /// + /// TestResults Stores all the Summary and the details of evrey Results in Hiearachial order. + /// + public TestResults TestResults { get; private set; } + + /// + /// Total Passed Tests in the TestResults + /// + public int PassedTests { get; private set; } + + /// + /// Total FailedTests in the Results + /// + public int FailedTests { get; private set; } + + /// + /// Total Tests in the Results + /// + public int TotalTests { get; private set; } + + /// + /// Total SkippedTests in the Results + /// + public int SkippedTests { get; private set; } + private string fileName; + public string xmlFilePath { get; private set; } + public string htmlFilePath { get; private set; } + + public void Initialize(TestLoggerEvents events, string TestResultsDirPath) { if (events == null) { throw new ArgumentNullException(nameof(events)); } - if (string.IsNullOrEmpty(testResultsDirPath)) + if (string.IsNullOrEmpty(TestResultsDirPath)) { - throw new ArgumentNullException(nameof(testResultsDirPath)); + throw new ArgumentNullException(nameof(TestResultsDirPath)); } // Register for the events. @@ -91,8 +98,8 @@ public void Initialize(TestLoggerEvents events, string testResultsDirPath) events.TestResult += this.TestResultHandler; events.TestRunComplete += this.TestRunCompleteHandler; - this.TestResultsDirPath = testResultsDirPath; - this.testResults = new TestResults(); + this.TestResultsDirPath = TestResultsDirPath; + this.TestResults = new TestResults(); this.Results = new ConcurrentDictionary(); } @@ -103,32 +110,35 @@ public void Initialize(TestLoggerEvents events, Dictionary param { throw new ArgumentNullException(nameof(parameters)); } - + if (parameters.Count == 0) { throw new ArgumentException("No default parameters added", nameof(parameters)); } - - this.parametersDictionary = parameters; - this.Initialize(events, this.parametersDictionary[DefaultLoggerParameterNames.TestRunDirectory]); + + this.Initialize(events, parameters[DefaultLoggerParameterNames.TestRunDirectory]); } + /// + /// Handles the Message level information like warnings errors etc.. + /// + /// + /// internal void TestMessageHandler(object sender, TestRunMessageEventArgs e) { ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); - - // TrxLoggerObjectModel.RunInfo runMessage; + switch (e.Level) { case TestMessageLevel.Informational: - testResults.RunLevelMessageInformational.Add(e.Message); + TestResults.RunLevelMessageInformational.Add(e.Message); break; case TestMessageLevel.Warning: - testResults.RunLevelMessageErrorAndWarning.Add(e.Message); + TestResults.RunLevelMessageErrorAndWarning.Add(e.Message); break; case TestMessageLevel.Error: - testResults.RunLevelMessageErrorAndWarning.Add(e.Message); + TestResults.RunLevelMessageErrorAndWarning.Add(e.Message); break; default: Debug.Fail("htmlLogger.TestMessageHandler: The test message level is unrecognized: {0}", e.Level.ToString()); @@ -136,104 +146,170 @@ internal void TestMessageHandler(object sender, TestRunMessageEventArgs e) } } + /// + /// Handles the Result coming from vstest and store it in testresults + /// + /// + /// internal void TestResultHandler(object sender, TestResultEventArgs e) { ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); - Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.TestResult testResult = new Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.TestResult() ; - if(e.Result.DisplayName!=null) + TestResult testResult = new TestResult(); + if (e.Result.DisplayName != null) testResult.DisplayName = e.Result.DisplayName; else testResult.DisplayName = e.Result.TestCase.DisplayName; testResult.FullyQualifiedName = e.Result.TestCase.FullyQualifiedName; - //yet to test... - testResult.Duration = e.Result.Duration; + testResult.Duration = GetFormattedDurationString(e.Result.Duration); testResult.ErrorStackTrace = e.Result.ErrorStackTrace; testResult.ErrorMessage = e.Result.ErrorMessage; - //yet to test.. - var executionId = Converter.GetExecutionId(e.Result); - var parentExecutionId = Converter.GetParentExecutionId(e.Result); - - this.totalTests++; - + var executionId = this.GetExecutionId(e.Result); + var parentExecutionId = this.GetParentExecutionId(e.Result); + /// TODO: handle skipped tests + this.TotalTests++; testResult.resultOutcome = e.Result.Outcome; if (e.Result.Outcome == TestOutcome.Failed) { - this.failTests++; + this.FailedTests++; } else if (e.Result.Outcome == TestOutcome.Passed) { - this.passTests++; + this.PassedTests++; + } + else if (e.Result.Outcome == TestOutcome.Skipped) + { + this.SkippedTests++; } - if(parentExecutionId==Guid.Empty) - testResults.Results.Add(testResult); + if (parentExecutionId == Guid.Empty) + TestResults.Results.Add(testResult); Results.TryAdd(executionId, testResult); - if(parentExecutionId!= Guid.Empty) + if (parentExecutionId != Guid.Empty) { - this.AddToParentResult(executionId,parentExecutionId,testResult); + this.AddToParentResult(parentExecutionId, testResult); } } - internal void AddToParentResult(Guid executionId,Guid parentExecutionId ,TestResult testResult) + private void AddToParentResult( Guid parentExecutionId, TestResult testResult) { TestResult ParentTestResult; this.Results.TryGetValue(parentExecutionId, out ParentTestResult); if (ParentTestResult.innerTestResults == null) ParentTestResult.innerTestResults = new List(); ParentTestResult.innerTestResults.Add(testResult); - } - + /// + /// Creates a Summary of tests and Popultes the html file by transforming the xml file with help of xslt file + /// + /// + /// internal void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) { - testResults.Summary = new TestRunSummary + TestResults.Summary = new TestRunSummary { - FailedTests = this.failTests, - PassedTests = this.passTests, - TotalTests = this.totalTests + FailedTests = this.FailedTests, + PassedTests = this.PassedTests, + TotalTests = this.TotalTests }; - //var list = new List(); - //list.Add(new TestResult(new TestCase("abc", new Uri("executor://dummy"), "abc.dll"))); this.PopulateHtmlFile(); } private void PopulateHtmlFile() { - var xmlFilePath = GetXmlFilePath(); - Stream xmlStream = this.filehelper.GetStream(xmlFilePath, FileMode.Create); + // TODO: Add exception handling and logging + fileName = String.Format(CultureInfo.CurrentCulture, "{0}_{1}_{2}", Environment.GetEnvironmentVariable("UserName"), Environment.MachineName, FormatDateTimeForRunName(DateTime.Now)); + xmlFilePath = this.GetFilePath("xml",fileName); - var htmlFilePath = GetHtmlFilePath(); - xmlSerializer.WriteObject(xmlStream, testResults); + Stream xmlStream = this.filehelper.GetStream(xmlFilePath, FileMode.Create); + xmlSerializer.WriteObject(xmlStream, TestResults); xmlStream.Close(); + htmlFilePath = this.GetFilePath("html", fileName); htmlTransformer.Transform(xmlFilePath, htmlFilePath); } - private string GetHtmlFilePath() + private string GetFilePath(string fileFormat,string FileName) + { + var fullfileformat = string.Concat("." + fileFormat); + return Path.Combine(this.TestResultsDirPath, string.Concat("TestResult_", FileName, fullfileformat)); + } + + + private static string FormatDateTimeForRunName(DateTime timeStamp) + { + return timeStamp.ToString("yyyyMMdd_HHmmss", DateTimeFormatInfo.InvariantInfo); + } + + /// + /// Gives the parent execution id of a TestResult + /// + /// + /// + private Guid GetParentExecutionId(ObjectModel.TestResult testResult) { - this.htmlFileName = GetFileName("html"); - var htmlFilePath = Path.Combine(this.TestResultsDirPath, htmlFileName); - return htmlFilePath; + TestProperty parentExecutionIdProperty = testResult.Properties.FirstOrDefault(property => property.Id.Equals(HtmlLoggerConstants.ParentExecutionIdPropertyIdentifier)); + return parentExecutionIdProperty == null ? Guid.Empty : testResult.GetPropertyValue(parentExecutionIdProperty, Guid.Empty); } - private string GetXmlFilePath() + /// + /// Gives the execution id of a TestResult + /// + /// + /// + private Guid GetExecutionId(ObjectModel.TestResult testResult) { - this.xmlFileName = GetFileName("xml"); - var xmlFilePath = Path.Combine(this.TestResultsDirPath, xmlFileName); - return xmlFilePath; + TestProperty executionIdProperty = testResult.Properties.FirstOrDefault(property => property.Id.Equals(HtmlLoggerConstants.ExecutionIdPropertyIdentifier)); + var executionId = Guid.Empty; + if (executionIdProperty != null) + executionId = testResult.GetPropertyValue(executionIdProperty, Guid.Empty); + + return executionId.Equals(Guid.Empty) ? Guid.NewGuid() : executionId; } - private string GetFileName(string fileFormat) + /// + /// converts the timespan format to readable string + /// + /// + /// + private string GetFormattedDurationString(TimeSpan duration) { - var fullfileformat = string.Concat("." +fileFormat); - return string.Concat("TestResult_", DateTime.Now.ToLongDateString(), fullfileformat); + if (duration == default(TimeSpan)) + { + return null; + } + + var time = new List(); + if (duration.Hours > 0) + { + time.Add(duration.Hours + "h"); + } + + if (duration.Minutes > 0) + { + time.Add(duration.Minutes + "m"); + } + + if (duration.Hours == 0) + { + if (duration.Seconds > 0) + { + time.Add(duration.Seconds + "s"); + } + + if (duration.Milliseconds > 0 && duration.Minutes == 0) + { + time.Add(duration.Milliseconds + "ms"); + } + } + + return time.Count == 0 ? "< 1ms" : string.Join(" ", time); } } } \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs index bb3e16d963..293cdba708 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs @@ -1,7 +1,7 @@ -using System; -using System.Collections.Generic; +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + using System.IO; -using System.Text; using System.Xml; using System.Xml.Xsl; namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger @@ -11,12 +11,18 @@ class HtmlTransformer : IHtmlTransformer StringReader xsltStringReader = new StringReader(Resources.Html); XslCompiledTransform myXslTransform; + /// + /// the following function invoesthe compiled tranform and Loads the xslt file + /// public HtmlTransformer() { myXslTransform = new XslCompiledTransform(); myXslTransform.Load(XmlReader.Create(xsltStringReader)); } + /// + ///It transforms the xmlfile to htmlfile + /// public void Transform(string xmlfile,string htmlfile) { myXslTransform.Transform(xmlfile, htmlfile); diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs index 5f12d4b52e..3a19571cf9 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs @@ -3,13 +3,10 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { - /// - /// - /// public interface IHtmlTransformer { /// - /// + /// It transforms the xmlfile to htmlfile /// /// /// diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs index b87e59f942..4e0b09f6f6 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs @@ -1,8 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + using System.Collections.Generic; using System.Runtime.Serialization; -using System.Text; -using Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger; namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { @@ -11,46 +11,43 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger public sealed class TestResults { /// - /// + /// constructor Class for testResults /// public TestResults() { } /// - /// + /// it has the test run summary of all test results /// [DataMember] internal TestRunSummary Summary { get; set; } /// - /// + /// List of Run Level Message that is Informational /// [DataMember] internal List RunLevelMessageInformational = new List(); /// - /// + /// List of Run Level MessageError and warnings /// [DataMember] internal List RunLevelMessageErrorAndWarning = new List(); /// - /// + /// List of all results in Hieracheal model /// [DataMember] internal List Results = new List(); - - /// - /// + /// Gives the count of elements that Present in the Results List /// /// internal int GetTestResultscount() { return this.Results.Count; } - } } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs index a92a64e98f..71da9d0c48 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs @@ -1,10 +1,27 @@ -namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { public class TestRunSummary { + /// + /// total tests of a testrun + /// public int TotalTests { get; set; } + + /// + /// Passed tests of test run + /// public int PassedTests { get; set; } + + /// + /// Failed Tests of test run + /// public int FailedTests { get; set; } + + /// + /// Skipped Tests of test run + /// public int SkippedTests { get; set; } } } \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs index 1f43a91a41..d93adcfca6 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs @@ -1,26 +1,62 @@ -using Microsoft.VisualStudio.TestPlatform.ObjectModel; +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.VisualStudio.TestPlatform.ObjectModel; using System; using System.Collections.Generic; -using System.Text; namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { - public class TestResult { + /// + /// Fully Qualified name of test result + /// public string FullyQualifiedName; + + /// + /// DisplayName for the Particular TestResult.It is unique for each Testresult + /// public string DisplayName; + + /// + /// the error stact trace of the testResult + /// public string ErrorStackTrace; + + /// + /// error message of the testresult + /// public string ErrorMessage; + + /// + /// it is enum whether the testresult is passed failed or skipped + /// public TestOutcome resultOutcome; - - public TimeSpan Duration { get; set; } + /// + /// total timespan of the testresult + /// + public string Duration { get; set; } + + /// + /// the list of testresults that are chioldren to the current TestResults + /// public List innerTestResults; + + /// + /// get the count of inner testresults count + /// + /// internal int GetInnerTestResultscount() { return this.innerTestResults.Count; } + + /// + /// givest the current testresult + /// + /// internal TestResult GetTestResult() { return this; diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs index 42fd482cb3..86b574cdeb 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs @@ -1,13 +1,15 @@ -namespace Microsoft.TestPlatform.Extensions.HtmlLogger.Utility +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.Extensions.HtmlLogger.Utility { using System; - // using Microsoft.TestPlatform.Extensions.HtmlLogger.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel; internal static class Constants { /// - /// Uri used to uniquely identify the TRX logger. + /// Uri used to uniquely identify the Html logger. /// public const string ExtensionUri = "logger://Microsoft/TestPlatform/HtmlLogger/v1"; @@ -15,12 +17,32 @@ internal static class Constants /// Alternate user friendly string to uniquely identify the console logger. /// public const string FriendlyName = "Html"; + + /// /// + /// Property Id storing the TestType. + /// public const string TestTypePropertyIdentifier = "TestType"; + + /// + /// Ordered test type guid + /// public static readonly Guid OrderedTestTypeGuid = new Guid("ec4800e8-40e5-4ab3-8510-b8bf29b1904d"); + /// + /// Property Id storing the ParentExecutionId. + /// public const string ParentExecutionIdPropertyIdentifier = "ParentExecId"; + + /// + /// Property Id storing the ExecutionId. + /// public const string ExecutionIdPropertyIdentifier = "ExecutionId"; - public const string LogFileNameKey = "LogFileName"; + + /// + /// Log file parameter key + /// + public const string LogFileNameKey = "LogFileName"; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty ExecutionIdProperty = TestProperty.Register("ExecutionId", ExecutionIdPropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(VisualStudio.TestPlatform.ObjectModel.TestResult)); diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/converter.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/converter.cs deleted file mode 100644 index 33a453d571..0000000000 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/converter.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestPlatform.ObjectModel; -using Microsoft.TestPlatform.Extensions.HtmlLogger.Utility; -using Constants = Microsoft.TestPlatform.Extensions.HtmlLogger.Utility.Constants; - -namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger -{ - class Converter - { - public static Guid GetParentExecutionId(ObjectModel.TestResult testResult) - { - TestProperty parentExecutionIdProperty = testResult.Properties.FirstOrDefault( - property => property.Id.Equals(Constants.ParentExecutionIdPropertyIdentifier)); - - return parentExecutionIdProperty == null ? - Guid.Empty : - testResult.GetPropertyValue(parentExecutionIdProperty, Guid.Empty); - } - - - public static Guid GetExecutionId(ObjectModel.TestResult testResult) - { - TestProperty executionIdProperty = testResult.Properties.FirstOrDefault( - property => property.Id.Equals(Constants.ExecutionIdPropertyIdentifier)); - - var executionId = Guid.Empty; - if (executionIdProperty != null) - executionId = testResult.GetPropertyValue(executionIdProperty, Guid.Empty); - - return executionId.Equals(Guid.Empty) ? Guid.NewGuid() : executionId; - } - } - - -} diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs index ebb4ecd84f..bc09f77677 100644 --- a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs @@ -11,16 +11,14 @@ namespace Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests using ObjectModel = VisualStudio.TestPlatform.ObjectModel; using VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger; - using HtmlLoggerConstants = Microsoft.TestPlatform.Extensions.HtmlLogger.Utility.Constants; + using HtmlLoggerConstants = Utility.Constants; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using HtmlLogger = VisualStudio.TestPlatform.Extensions.HtmlLogger; - using System.Text; using System.Collections.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using System.Linq; - using System.Xml; - using System.Xml.Linq; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; + using System.Runtime.Serialization; [TestClass] public class HtmlLoggerTests @@ -30,20 +28,28 @@ public class HtmlLoggerTests private Dictionary parameters; private static string DefaultTestRunDirectory = Path.GetTempPath(); private static string DefaultLogFileNameParameterValue = "logfilevalue.trx"; + private Mock mockFileHelper; + private Mock mockXmlSerializer ; + private Mock mockHtmlTransformer; [TestInitialize] public void Initialize() { this.events = new Mock(); - this.htmlLogger = new Htmllogger(); + this.mockFileHelper = new Mock(); + this.mockHtmlTransformer = new Mock(); + this.mockXmlSerializer = new Mock(); + this.htmlLogger = new Htmllogger(this.mockFileHelper.Object, this.mockHtmlTransformer.Object, this.mockXmlSerializer.Object); this.parameters = new Dictionary(2); - this.parameters[ObjectModel.DefaultLoggerParameterNames.TestRunDirectory] = HtmlLoggerTests.DefaultTestRunDirectory; + this.parameters[DefaultLoggerParameterNames.TestRunDirectory] = HtmlLoggerTests.DefaultTestRunDirectory; this.parameters[HtmlLoggerConstants.LogFileNameKey] = HtmlLoggerTests.DefaultLogFileNameParameterValue; this.htmlLogger.Initialize(this.events.Object, this.parameters); - - } + + /// + /// if events is null initialize should throw exception + /// [TestMethod] public void InitializeShouldThrowExceptionIfEventsIsNull() { @@ -54,6 +60,9 @@ public void InitializeShouldThrowExceptionIfEventsIsNull() }); } + /// + /// initilaize should initialize all Properties + /// [TestMethod] public void InitializeShouldInitializeAllProperties() { @@ -63,13 +72,13 @@ public void InitializeShouldInitializeAllProperties() this.htmlLogger.Initialize(events.Object, testResultDir); Assert.AreEqual(this.htmlLogger.TestResultsDirPath, testResultDir); - Assert.IsNotNull(this.htmlLogger.GetTestResults()); - - Assert.IsNotNull(this.htmlLogger.GetResults()); + Assert.IsNotNull(this.htmlLogger.TestResults); + Assert.IsNotNull(this.htmlLogger.Results); } - - + /// + /// if test run directory is null the initialize should throw exception + /// [TestMethod] public void InitializeShouldThrowExceptionIfTestRunDirectoryIsEmptyOrNull() { @@ -82,7 +91,9 @@ public void InitializeShouldThrowExceptionIfTestRunDirectoryIsEmptyOrNull() }); } - + /// + /// initialize should throw exception if parameters are empty + /// [TestMethod] public void InitializeShouldThrowExceptionIfParametersAreEmpty() { @@ -90,6 +101,9 @@ public void InitializeShouldThrowExceptionIfParametersAreEmpty() Assert.ThrowsException(() => this.htmlLogger.Initialize(events.Object, new Dictionary())); } + /// + /// if event args is null test message handler should throw exception + /// [TestMethod] public void TestMessageHandlerShouldThrowExceptionIfEventArgsIsNull() { @@ -99,62 +113,61 @@ public void TestMessageHandlerShouldThrowExceptionIfEventArgsIsNull() }); } + /// + /// Test message handler should add informational messages to list of informational strings in test results + /// [TestMethod] public void TestMessageHandlerShouldAddMessageWhenItIsInformation() { string message = "First message"; - TestRunMessageEventArgs trme = new TestRunMessageEventArgs(TestMessageLevel.Informational, message); - HtmlLogger.TestResults testResults = this.CreateTestResults(); - this.htmlLogger.SetTestResults(testResults); + this.htmlLogger.TestMessageHandler(new object(), trme); - string actualMessage = this.htmlLogger.GetTestResults().RunLevelMessageInformational.First(); - Assert.AreEqual(message, actualMessage.ToString()); - + string actualMessage = this.htmlLogger.TestResults.RunLevelMessageInformational.First(); + Assert.AreEqual(message, actualMessage.ToString()); } + /// + /// Test message handler should add ierror and warning messages to list of error and warning strings in test results + /// [TestMethod] public void TestMessageHandlerShouldAddMessageInListIfItIsWarningAndError() { string message = "error message"; string message2 = "warning message"; - - HtmlLogger.TestResults testResults = this.CreateTestResults(); - this.htmlLogger.SetTestResults(testResults); TestRunMessageEventArgs trme = new TestRunMessageEventArgs(TestMessageLevel.Error, message); this.htmlLogger.TestMessageHandler(new object(), trme); TestRunMessageEventArgs trme2 = new TestRunMessageEventArgs(TestMessageLevel.Warning, message2); this.htmlLogger.TestMessageHandler(new object(), trme2); - - - Assert.AreEqual(message, this.htmlLogger.GetTestResults().RunLevelMessageErrorAndWarning.First()); - Assert.AreEqual(2, this.htmlLogger.GetTestResults().RunLevelMessageErrorAndWarning.Count()); + Assert.AreEqual(message, this.htmlLogger.TestResults.RunLevelMessageErrorAndWarning.First()); + Assert.AreEqual(2, this.htmlLogger.TestResults.RunLevelMessageErrorAndWarning.Count()); } - - + /// + /// Test result handler should keep track of passed failed total skipped tests summary + /// [TestMethod] public void TestResultHandlerShouldKeepTrackofSummary() { - ObjectModel.TestCase passTestCase1 = CreateTestCase("Pass1"); - ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass2"); - ObjectModel.TestCase failTestCase1 = CreateTestCase("Fail1"); - ObjectModel.TestCase skipTestCase1 = CreateTestCase("Skip1"); + TestCase passTestCase1 = CreateTestCase("Pass1"); + TestCase passTestCase2 = CreateTestCase("Pass2"); + TestCase failTestCase1 = CreateTestCase("Fail1"); + TestCase skipTestCase1 = CreateTestCase("Skip1"); ObjectModel.TestResult passResult1 = new ObjectModel.TestResult(passTestCase1); - passResult1.Outcome = ObjectModel.TestOutcome.Passed; + passResult1.Outcome = TestOutcome.Passed; ObjectModel.TestResult passResult2 = new ObjectModel.TestResult(passTestCase2); - passResult2.Outcome = ObjectModel.TestOutcome.Passed; + passResult2.Outcome = TestOutcome.Passed; ObjectModel.TestResult failResult1 = new ObjectModel.TestResult(failTestCase1); - failResult1.Outcome = ObjectModel.TestOutcome.Failed; + failResult1.Outcome = TestOutcome.Failed; ObjectModel.TestResult skipResult1 = new ObjectModel.TestResult(skipTestCase1); - skipResult1.Outcome = ObjectModel.TestOutcome.Skipped; + skipResult1.Outcome = TestOutcome.Skipped; Mock pass1 = new Mock(passResult1); Mock pass2 = new Mock(passResult2); @@ -167,17 +180,19 @@ public void TestResultHandlerShouldKeepTrackofSummary() this.htmlLogger.TestResultHandler(new object(), fail1.Object); this.htmlLogger.TestResultHandler(new object(), skip1.Object); - Assert.AreEqual(this.htmlLogger.passTests, 2, "Passed Tests"); - Assert.AreEqual(this.htmlLogger.failTests, 1, "Failed Tests"); - Assert.AreEqual(this.htmlLogger.totalTests, 4, "Total Tests"); - + Assert.AreEqual(this.htmlLogger.PassedTests, 2, "Passed Tests"); + Assert.AreEqual(this.htmlLogger.FailedTests, 1, "Failed Tests"); + Assert.AreEqual(this.htmlLogger.TotalTests, 4, "Total Tests"); } + /// + /// Test Result handler should set dispaly name in test result Properly + /// [TestMethod] - public void TestResultHandlerShouldCreateDisplayNameIfNullProperly() + public void TestResultHandlerShouldSetDisplayNameIfNullProperly() { //this assert is for checking result dispalyname equals to null - ObjectModel.TestCase passTestCase1 = CreateTestCase("Pass1"); + TestCase passTestCase1 = CreateTestCase("Pass1"); ObjectModel.TestResult PassTestResultExpected = new ObjectModel.TestResult(passTestCase1); PassTestResultExpected.DisplayName = null; PassTestResultExpected.TestCase.DisplayName = "abc"; @@ -191,12 +206,9 @@ public void TestResultHandlerShouldCreateDisplayNameIfNullProperly() passTestResultActual.resultOutcome = TestOutcome.Passed; passTestResultActual.DisplayName = "abc"; - Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.GetTestResults().Results.First().DisplayName); - // Assert.AreEqual( passTestResultActual,this.htmlLogger.GetTestResults().Results.First()); - - //this assert is for checking result dispalyname equals to notnull - - ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass1"); + Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestResults.Results.First().DisplayName); + + TestCase passTestCase2 = CreateTestCase("Pass1"); ObjectModel.TestResult PassTestResultExpected1 = new ObjectModel.TestResult(passTestCase1); PassTestResultExpected.DisplayName = "def"; PassTestResultExpected.TestCase.DisplayName = "abc"; @@ -208,42 +220,16 @@ public void TestResultHandlerShouldCreateDisplayNameIfNullProperly() passTestResultActual.resultOutcome = TestOutcome.Passed; passTestResultActual.DisplayName = "def"; - Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.GetTestResults().Results.Last().DisplayName); - // Assert.AreEqual(passTestResultActual1, this.htmlLogger.GetTestResults().Results.First()); - - - } - - [TestMethod] - public void TestResultHandlerShouldCreateDisplayNameIfNotNullProperly() - { - - //this assert is for checking result dispalyname equals to notnull - - ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass1"); - ObjectModel.TestResult PassTestResultExpected1 = new ObjectModel.TestResult(passTestCase2); - PassTestResultExpected1.DisplayName = "def"; - PassTestResultExpected1.TestCase.DisplayName = "abc"; - - Mock pass2 = new Mock(PassTestResultExpected1); - this.htmlLogger.TestResultHandler(new object(), pass2.Object); - - HtmlLogger.TestResult passTestResultActual1 = new HtmlLogger.TestResult(); - passTestResultActual1.resultOutcome = TestOutcome.Passed; - passTestResultActual1.DisplayName = "def"; - - - Assert.AreEqual(passTestResultActual1, this.htmlLogger.GetTestResults().Results.First()); - + Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestResults.Results.Last().DisplayName); } + /// + /// Test Result Handler should create test result properly + /// [TestMethod] public void TestResultHandlerShouldCreateTestResultProperly() { - - //this assert is for checking result dispalyname equals to notnull - - ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass1"); + TestCase passTestCase2 = CreateTestCase("Pass1"); passTestCase2.DisplayName = "abc"; passTestCase2.FullyQualifiedName = "fully"; @@ -251,49 +237,37 @@ public void TestResultHandlerShouldCreateTestResultProperly() { DisplayName = "def", ErrorMessage = "error message", - ErrorStackTrace = "Error strack trace" + ErrorStackTrace = "Error strack trace", + Duration = TimeSpan.Zero }; - Mock eventArg = new Mock(PassTestResultExpected1); this.htmlLogger.TestResultHandler(new object(), eventArg.Object); - var result = this.htmlLogger.GetTestResults().Results.First(); - - Assert.AreEqual(result.Duration, ""); - Assert.AreEqual(result.Duration, ""); - Assert.AreEqual(result.Duration, ""); - Assert.AreEqual(result.Duration, ""); - Assert.AreEqual(result.Duration, ""); - - } - - - - private HtmlLogger.TestResult CreateTestResult(ObjectModel.TestOutcome testoutcome,string displayName) - { - - HtmlLogger.TestResult testResult = new HtmlLogger.TestResult(); - testResult.resultOutcome = testoutcome; - testResult.DisplayName = displayName; - return testResult; + var result = this.htmlLogger.TestResults.Results.First(); + + Assert.AreEqual(result.DisplayName, "def"); + Assert.AreEqual(result.ErrorMessage, "error message"); + Assert.AreEqual(result.ErrorStackTrace, "Error strack trace"); + Assert.AreEqual(result.FullyQualifiedName, "fully"); + Assert.AreEqual(result.Duration, null); } + /// + /// test result should create one test result for one resutlt event args + /// [TestMethod] public void TestResultHandlerShouldCreateOneTestEntryForEachTestCase() { - ObjectModel.TestCase testCase1 = CreateTestCase("TestCase1"); - ObjectModel.TestCase testCase2 = CreateTestCase("TestCase2"); - - HtmlLogger.TestResults testResults = this.CreateTestResults(); - this.htmlLogger.SetTestResults(testResults); - + TestCase testCase1 = CreateTestCase("TestCase1"); + TestCase testCase2 = CreateTestCase("TestCase2"); + ObjectModel.TestResult result1 = new ObjectModel.TestResult(testCase1); - result1.Outcome = ObjectModel.TestOutcome.Failed; + result1.Outcome = TestOutcome.Failed; ObjectModel.TestResult result2 = new ObjectModel.TestResult(testCase2); - result2.Outcome = ObjectModel.TestOutcome.Passed; + result2.Outcome = TestOutcome.Passed; Mock resultEventArg1 = new Mock(result1); Mock resultEventArg2 = new Mock(result2); @@ -301,15 +275,15 @@ public void TestResultHandlerShouldCreateOneTestEntryForEachTestCase() this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); - Assert.AreEqual(this.htmlLogger.GetTestResults().GetTestResultscount(), 2, "TestResultHandler is not creating test result entry for each test case"); + Assert.AreEqual(this.htmlLogger.TestResults.GetTestResultscount(), 2, "TestResultHandler is not creating test result entry for each test case"); } [TestMethod] public void TestResultHandlerShouldAddHierarchicalResultsForOrderedTest() { - ObjectModel.TestCase testCase1 = CreateTestCase("TestCase1"); - ObjectModel.TestCase testCase2 = CreateTestCase("TestCase2"); - ObjectModel.TestCase testCase3 = CreateTestCase("TestCase3"); + TestCase testCase1 = CreateTestCase("TestCase1"); + TestCase testCase2 = CreateTestCase("TestCase2"); + TestCase testCase3 = CreateTestCase("TestCase3"); Guid parentExecutionId = Guid.NewGuid(); @@ -317,51 +291,54 @@ public void TestResultHandlerShouldAddHierarchicalResultsForOrderedTest() result1.SetPropertyValue(HtmlLoggerConstants.ExecutionIdProperty, parentExecutionId); result1.SetPropertyValue(HtmlLoggerConstants.TestTypeProperty, HtmlLoggerConstants.OrderedTestTypeGuid); + Mock resultEventArg1 = new Mock(result1); + + this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); + + Assert.AreEqual(this.htmlLogger.TestResults.GetTestResultscount(), 1, "testhandler is adding parent result correctly"); + Assert.IsNull(this.htmlLogger.TestResults.Results[0].innerTestResults, "testhandler is adding child result correctly"); + ObjectModel.TestResult result2 = new ObjectModel.TestResult(testCase2); result2.SetPropertyValue(HtmlLoggerConstants.ExecutionIdProperty, Guid.NewGuid()); result2.SetPropertyValue(HtmlLoggerConstants.ParentExecIdProperty, parentExecutionId); ObjectModel.TestResult result3 = new ObjectModel.TestResult(testCase3); - result3.Outcome = ObjectModel.TestOutcome.Failed; + result3.Outcome = TestOutcome.Failed; result3.SetPropertyValue(HtmlLoggerConstants.ExecutionIdProperty, Guid.NewGuid()); result3.SetPropertyValue(HtmlLoggerConstants.ParentExecIdProperty, parentExecutionId); - Mock resultEventArg1 = new Mock(result1); Mock resultEventArg2 = new Mock(result2); Mock resultEventArg3 = new Mock(result3); - this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); this.htmlLogger.TestResultHandler(new object(), resultEventArg3.Object); - Assert.AreEqual(this.htmlLogger.GetTestResults().GetTestResultscount(), 1, "testhandler is adding parent result correctly"); - Assert.AreEqual(this.htmlLogger.GetTestResults().Results[0].GetInnerTestResultscount(), 2, "testhandler is adding child result correctly"); - - + Assert.AreEqual(this.htmlLogger.TestResults.GetTestResultscount(), 1, "testhandler is adding parent result correctly"); + Assert.AreEqual(this.htmlLogger.TestResults.Results[0].GetInnerTestResultscount(), 2, "testhandler is adding child result correctly"); } + /// + /// Test comple handler should set summary property in test results properly + /// [TestMethod] public void TestCompleteHandlerShouldKeepTackOfSummary() { - ObjectModel.TestCase passTestCase1 = CreateTestCase("Pass1"); - ObjectModel.TestCase passTestCase2 = CreateTestCase("Pass2"); - ObjectModel.TestCase failTestCase1 = CreateTestCase("Fail1"); - ObjectModel.TestCase skipTestCase1 = CreateTestCase("Skip1"); - - HtmlLogger.TestResults testResults = this.CreateTestResults(); - this.htmlLogger.SetTestResults(testResults); + TestCase passTestCase1 = CreateTestCase("Pass1"); + TestCase passTestCase2 = CreateTestCase("Pass2"); + TestCase failTestCase1 = CreateTestCase("Fail1"); + TestCase skipTestCase1 = CreateTestCase("Skip1"); ObjectModel.TestResult passResult1 = new ObjectModel.TestResult(passTestCase1); - passResult1.Outcome = ObjectModel.TestOutcome.Passed; + passResult1.Outcome = TestOutcome.Passed; ObjectModel.TestResult passResult2 = new ObjectModel.TestResult(passTestCase2); - passResult2.Outcome = ObjectModel.TestOutcome.Passed; + passResult2.Outcome = TestOutcome.Passed; ObjectModel.TestResult failResult1 = new ObjectModel.TestResult(failTestCase1); - failResult1.Outcome = ObjectModel.TestOutcome.Failed; + failResult1.Outcome = TestOutcome.Failed; ObjectModel.TestResult skipResult1 = new ObjectModel.TestResult(skipTestCase1); - skipResult1.Outcome = ObjectModel.TestOutcome.Skipped; + skipResult1.Outcome = TestOutcome.Skipped; Mock pass1 = new Mock(passResult1); Mock pass2 = new Mock(passResult2); @@ -374,60 +351,70 @@ public void TestCompleteHandlerShouldKeepTackOfSummary() this.htmlLogger.TestResultHandler(new object(), fail1.Object); this.htmlLogger.TestResultHandler(new object(), skip1.Object); + string fileName; + this.mockFileHelper.Setup(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite)).Callback((x, y, z) => fileName = x).Returns(new Mock().Object); + this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); - Assert.AreEqual(this.htmlLogger.GetTestResults().Summary.TotalTests, 4, "summary should keep track of totaltests"); - Assert.AreEqual(this.htmlLogger.GetTestResults().Summary.FailedTests, 1, "summary should keep track of failedtests"); - Assert.AreEqual(this.htmlLogger.GetTestResults().Summary.PassedTests, 2, "summary should keep track of passedtests"); + Assert.AreEqual(this.htmlLogger.TestResults.Summary.TotalTests, 4, "summary should keep track of totaltests"); + Assert.AreEqual(this.htmlLogger.TestResults.Summary.FailedTests, 1, "summary should keep track of failedtests"); + Assert.AreEqual(this.htmlLogger.TestResults.Summary.PassedTests, 2, "summary should keep track of passedtests"); } + /// + /// Test complete handle should create file correctly + /// [TestMethod] - public void TestRunInformationShouldContainUtcDateTime() + public void TestCompleteHandlerShouldCreateFileCorrectly() { - HtmlLogger.TestResults testResults = this.CreateTestResults(); - this.htmlLogger.SetTestResults(testResults); - this.MakeTestRunComplete(); + string fileName; + this.mockFileHelper.Setup(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite)).Callback((x, y, z) => fileName = x).Returns(new Mock().Object); + this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); - this.ValidateDateTimeInTrx(this.htmlLogger.htmlFileName,"should handle htmlfilename time to meet bounds of utc"); - this.ValidateDateTimeInTrx(this.htmlLogger.xmlFileName, "should handle xmlfilename time to meet bounds of utc"); + this.mockFileHelper.Verify(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite), Times.Once); } - private void ValidateDateTimeInTrx(string htmlFileName,string error) + [TestMethod] + public void TestCompleteHandlerShouldCallHtmlTransformerCorrectly() { - this.mockFileHelper = new Mock(); - this.mockFileHelper.Verify(x => x.WriteAllTextToFile(htmlFileName, It.IsAny()), Times.Once); - - //using (FileStream file = File.OpenRead(htmlFileName)) - //{ - // using (XmlReader reader = XmlReader.Create(htmlFileName)) - // { - // XDocument document = XDocument.Load(htmlFileName); - // var timesNode = document.Descendants(document.Root.GetDefaultNamespace() + "Times").FirstOrDefault(); - // ValidateTimeWithinUtcLimits(DateTimeOffset.Parse(timesNode.Attributes("creation").FirstOrDefault().Value),error); - // ValidateTimeWithinUtcLimits(DateTimeOffset.Parse(timesNode.Attributes("start").FirstOrDefault().Value),error); - // var resultNode = document.Descendants(document.Root.GetDefaultNamespace() + "UnitTestResult").FirstOrDefault(); - // ValidateTimeWithinUtcLimits(DateTimeOffset.Parse(resultNode.Attributes("endTime").FirstOrDefault().Value),error); - // ValidateTimeWithinUtcLimits(DateTimeOffset.Parse(resultNode.Attributes("startTime").FirstOrDefault().Value),error); - // } - //} + string fileName; + this.mockFileHelper.Setup(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite)).Callback((x, y, z) => fileName = x).Returns(new Mock().Object); + this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); + this.mockHtmlTransformer.Verify(x => x.Transform(It.IsAny(), It.IsAny()), Times.Once); + } + + [TestMethod] + public void TestCompleteHandlerShouldWriteToXmlSerializerCorrectly() + { + string fileName; + this.mockFileHelper.Setup(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite)).Callback((x, y, z) => fileName = x).Returns(new Mock().Object); + + this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); + + this.mockXmlSerializer.Verify(x => x.WriteObject(It.IsAny(), It.IsAny()), Times.Once); + Assert.IsTrue(htmlLogger.xmlFilePath.Contains(".xml")); + Assert.IsTrue(htmlLogger.htmlFilePath.Contains(".html")); } - private void ValidateTimeWithinUtcLimits(DateTimeOffset dateTime,string error) + private HtmlLogger.TestResult CreateTestResult(TestOutcome testoutcome, string displayName) { - Assert.IsTrue(dateTime.UtcDateTime.Subtract(DateTime.UtcNow) < new TimeSpan(0, 0, 0, 60),error); + + HtmlLogger.TestResult testResult = new HtmlLogger.TestResult(); + testResult.resultOutcome = testoutcome; + testResult.DisplayName = displayName; + return testResult; } - private HtmlLogger.TestResults CreateTestResults() + private TestResults CreateTestResults() { - HtmlLogger.TestResults testresults = new HtmlLogger.TestResults(); - //testresults.Summary.PassedTests = 1; + TestResults testresults = new TestResults(); return testresults; } private static TestCase CreateTestCase(string testCaseName) { - return new ObjectModel.TestCase(testCaseName, new Uri("some://uri"), "DummySourceFileName"); + return new TestCase(testCaseName, new Uri("some://uri"), "DummySourceFileName"); } private static TestRunCompleteEventArgs CreateTestRunCompleteEventArgs() @@ -449,7 +436,6 @@ private static Mock CreatePassTestResultEventArgsMock(strin passResult.Messages.Add(message); } } - return new Mock(passResult); } @@ -461,9 +447,7 @@ private void MakeTestRunComplete() this.htmlLogger.TestRunCompleteHandler(new object(), testRunCompleteEventArgs); } - } - } From 0ed9a7e9777bb43a15ed287368f64c378e4eec5d Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Thu, 8 Aug 2019 19:12:28 +0530 Subject: [PATCH 04/20] Html logger acceptance Test added Resources files added updated packeges.json with html logger project Added exception handling and eqt trace logging to files --- .../Html.xslt | 122 +++-- .../HtmlLogger.cs | 87 +++- .../HtmlTransformer.cs | 16 +- .../IHtmlTransformer.cs | 2 +- ....TestPlatform.Extensions.HtmlLogger.csproj | 22 +- .../{ => ObjectModel}/TestResults.cs | 10 +- .../{ => ObjectModel}/TestRunSummary.cs | 2 +- .../{ => ObjectModel}/Testresult.cs | 0 .../Resources/Html.xslt | 212 ++++++++ .../{ => Resources}/Resources.Designer.cs | 25 +- .../{ => Resources}/Resources.resx | 5 +- .../Resources/xlf/Resources.cs.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.de.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.es.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.fr.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.it.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.ja.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.ko.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.pl.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.pt-BR.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.ru.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.tr.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.xlf | 441 +++++++++++++++++ .../Resources/xlf/Resources.zh-Hans.xlf | 459 ++++++++++++++++++ .../Resources/xlf/Resources.zh-Hant.xlf | 459 ++++++++++++++++++ .../html.html | 58 --- .../sample.xml | 2 - src/package/package/package.csproj | 1 + .../LoggerTests.cs | 66 +++ ...rosoft.TestPlatform.AcceptanceTests.csproj | 1 + .../TestResults.html | 61 +++ ...orm.Extensions.HtmlLogger.UnitTests.csproj | 1 - 32 files changed, 6930 insertions(+), 171 deletions(-) rename src/Microsoft.TestPlatform.Extensions.HtmlLogger/{ => ObjectModel}/TestResults.cs (82%) rename src/Microsoft.TestPlatform.Extensions.HtmlLogger/{ => ObjectModel}/TestRunSummary.cs (95%) rename src/Microsoft.TestPlatform.Extensions.HtmlLogger/{ => ObjectModel}/Testresult.cs (100%) create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Html.xslt rename src/Microsoft.TestPlatform.Extensions.HtmlLogger/{ => Resources}/Resources.Designer.cs (79%) rename src/Microsoft.TestPlatform.Extensions.HtmlLogger/{ => Resources}/Resources.resx (96%) create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf delete mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/html.html delete mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/sample.xml create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/TestResults.html diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt index ecd3fc7e2a..f225e90613 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt @@ -1,8 +1,7 @@  - @@ -26,41 +25,64 @@ #testtable { border-collapse: collapse; } - #testtable, th, td { border: 1px solid black; } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + -

Summary

Results

-

TestResult

+
+

Summary

+ +
+
+ -
-
+
+
-
+
- @@ -76,8 +98,9 @@
+ -
+
+ - ErrorMessage: + ErrorMessage:
+ - ErrorStackTrace: + ErrorStackTrace:
+ - - FailedTests: + + FailedTests:  - +
+ - - PassedTests: + + PassedTests:  - +
- - - TotalTests: + + + + SkippedTests: + + + - +
+
+ + + + TotalTests:   + +
+ - DisplayName: + DisplayName:
+ - - + + + ✔ + - - + + + ✘ + - - - - - - - ✔ - - - - - ✘ - + - +
- + diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs index 0e16107e6e..4bc1220472 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs @@ -3,20 +3,23 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { - using System; - using System.Collections.Generic; - using System.Diagnostics; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; - using HtmlLoggerConstants = Microsoft.TestPlatform.Extensions.HtmlLogger.Utility.Constants; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; - using System.Runtime.Serialization; - using System.IO; - using System.Collections.Concurrent; - using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Utilities; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers; - using System.Linq; + using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Diagnostics; using System.Globalization; + using System.IO; + using System.Linq; + using System.Runtime.Serialization; + using System.Xml.Xsl; + using HtmlResource = Resources.Resources; + using HtmlLoggerConstants = Microsoft.TestPlatform.Extensions.HtmlLogger.Utility.Constants; /// /// Logger for generating Html log @@ -28,6 +31,8 @@ public class Htmllogger : ITestLoggerWithParameters private IFileHelper filehelper; private XmlObjectSerializer xmlSerializer; private IHtmlTransformer htmlTransformer; + private string fileName; + private Dictionary parametersDictionary; public Htmllogger() : this(new FileHelper(), new HtmlTransformer(), new DataContractSerializer(typeof(TestResults))) @@ -77,7 +82,6 @@ public Htmllogger(IFileHelper filehelper, IHtmlTransformer htmlTransformer, XmlO /// Total SkippedTests in the Results /// public int SkippedTests { get; private set; } - private string fileName; public string xmlFilePath { get; private set; } public string htmlFilePath { get; private set; } @@ -115,7 +119,7 @@ public void Initialize(TestLoggerEvents events, Dictionary param { throw new ArgumentException("No default parameters added", nameof(parameters)); } - + this.parametersDictionary = parameters; this.Initialize(events, parameters[DefaultLoggerParameterNames.TestRunDirectory]); } @@ -157,10 +161,7 @@ internal void TestResultHandler(object sender, TestResultEventArgs e) ValidateArg.NotNull(e, "e"); TestResult testResult = new TestResult(); - if (e.Result.DisplayName != null) - testResult.DisplayName = e.Result.DisplayName; - else - testResult.DisplayName = e.Result.TestCase.DisplayName; + testResult.DisplayName = e.Result.DisplayName ?? e.Result.TestCase.DisplayName; testResult.FullyQualifiedName = e.Result.TestCase.FullyQualifiedName; testResult.Duration = GetFormattedDurationString(e.Result.Duration); @@ -170,7 +171,6 @@ internal void TestResultHandler(object sender, TestResultEventArgs e) var executionId = this.GetExecutionId(e.Result); var parentExecutionId = this.GetParentExecutionId(e.Result); - /// TODO: handle skipped tests this.TotalTests++; testResult.resultOutcome = e.Result.Outcome; if (e.Result.Outcome == TestOutcome.Failed) @@ -187,7 +187,9 @@ internal void TestResultHandler(object sender, TestResultEventArgs e) } if (parentExecutionId == Guid.Empty) + { TestResults.Results.Add(testResult); + } Results.TryAdd(executionId, testResult); if (parentExecutionId != Guid.Empty) @@ -198,10 +200,13 @@ internal void TestResultHandler(object sender, TestResultEventArgs e) private void AddToParentResult( Guid parentExecutionId, TestResult testResult) { + // Needs to be tested! TestResult ParentTestResult; this.Results.TryGetValue(parentExecutionId, out ParentTestResult); + if (ParentTestResult.innerTestResults == null) ParentTestResult.innerTestResults = new List(); + ParentTestResult.innerTestResults.Add(testResult); } @@ -218,21 +223,51 @@ internal void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) PassedTests = this.PassedTests, TotalTests = this.TotalTests }; + + if (this.parametersDictionary != null) + { + var isLogFileNameParameterExists = this.parametersDictionary.TryGetValue(HtmlLoggerConstants.LogFileNameKey, out string logFileNameValue); + if (isLogFileNameParameterExists && !string.IsNullOrWhiteSpace(logFileNameValue)) + { + this.htmlFilePath = Path.Combine(this.TestResultsDirPath, logFileNameValue); + } + } + this.PopulateHtmlFile(); } private void PopulateHtmlFile() { - // TODO: Add exception handling and logging fileName = String.Format(CultureInfo.CurrentCulture, "{0}_{1}_{2}", Environment.GetEnvironmentVariable("UserName"), Environment.MachineName, FormatDateTimeForRunName(DateTime.Now)); - xmlFilePath = this.GetFilePath("xml",fileName); + xmlFilePath = this.GetFilePath("xml",this.fileName); + Stream xmlStream = null; - Stream xmlStream = this.filehelper.GetStream(xmlFilePath, FileMode.Create); - xmlSerializer.WriteObject(xmlStream, TestResults); - xmlStream.Close(); + try + { + xmlStream = this.filehelper.GetStream(xmlFilePath, FileMode.Create); + xmlSerializer.WriteObject(xmlStream, TestResults); + xmlStream.Close(); - htmlFilePath = this.GetFilePath("html", fileName); - htmlTransformer.Transform(xmlFilePath, htmlFilePath); + if (htmlFilePath == null) + { + htmlFilePath = this.GetFilePath("html", this.fileName); + } + htmlTransformer.Transform(xmlFilePath, htmlFilePath); + } + catch (IOException ioEx) + { + string ioexMessage = string.Format("HtmlLogger : Failed to create a xml file. Exception : {0}", ioEx.ToString()); + EqtTrace.Error(ioexMessage); + } + catch (XsltCompileException xslte) + { + string xslteMessage = string.Format("HtmlLogger : Failed to convert xml file to html file. Exception : {0}", xslte.ToString()); + EqtTrace.Error(xslteMessage); + } + + string htmlfilePathMessage = string.Format(CultureInfo.CurrentCulture, HtmlResource.HtmlFilePath, this.htmlFilePath); + EqtTrace.Info(htmlfilePathMessage); + ConsoleOutput.Instance.Information(false, this.htmlFilePath); } private string GetFilePath(string fileFormat,string FileName) @@ -241,7 +276,6 @@ private string GetFilePath(string fileFormat,string FileName) return Path.Combine(this.TestResultsDirPath, string.Concat("TestResult_", FileName, fullfileformat)); } - private static string FormatDateTimeForRunName(DateTime timeStamp) { return timeStamp.ToString("yyyyMMdd_HHmmss", DateTimeFormatInfo.InvariantInfo); @@ -267,14 +301,17 @@ private Guid GetExecutionId(ObjectModel.TestResult testResult) { TestProperty executionIdProperty = testResult.Properties.FirstOrDefault(property => property.Id.Equals(HtmlLoggerConstants.ExecutionIdPropertyIdentifier)); var executionId = Guid.Empty; + if (executionIdProperty != null) + { executionId = testResult.GetPropertyValue(executionIdProperty, Guid.Empty); + } return executionId.Equals(Guid.Empty) ? Guid.NewGuid() : executionId; } /// - /// converts the timespan format to readable string + /// Converts the timespan format to readable string /// /// /// diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs index 293cdba708..5627bf4569 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs @@ -1,18 +1,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.IO; -using System.Xml; -using System.Xml.Xsl; namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { + using System.IO; + using System.Xml; + using System.Xml.Xsl; + using HtmlResources = Resources.Resources; + class HtmlTransformer : IHtmlTransformer { - StringReader xsltStringReader = new StringReader(Resources.Html); + StringReader xsltStringReader = new StringReader(@"D:\Code\vstest\src\Microsoft.TestPlatform.Extensions.HtmlLogger\Html.xslt");//HtmlResources.Html); XslCompiledTransform myXslTransform; /// - /// the following function invoesthe compiled tranform and Loads the xslt file + /// The following function invokes the compiled tranform and Loads the xslt file. /// public HtmlTransformer() { @@ -21,9 +23,9 @@ public HtmlTransformer() } /// - ///It transforms the xmlfile to htmlfile + /// It transforms the xmlfile to htmlfile. /// - public void Transform(string xmlfile,string htmlfile) + public void Transform(string xmlfile, string htmlfile) { myXslTransform.Transform(xmlfile, htmlfile); } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs index 3a19571cf9..d3a59034c1 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/IHtmlTransformer.cs @@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger public interface IHtmlTransformer { /// - /// It transforms the xmlfile to htmlfile + /// It transforms the xmlfile to htmlfile. /// /// /// diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj index 4cba3b64f1..9b369c50dc 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj @@ -10,9 +10,6 @@ netstandard2.0;net451 netstandard2.0 - @@ -20,7 +17,7 @@ - + ResXFileCodeGenerator Resources.Designer.cs @@ -30,25 +27,18 @@ - + True True Resources.resx - + Resources.Designer.cs + + Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResults.cs similarity index 82% rename from src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs rename to src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResults.cs index 4e0b09f6f6..dccd2e85f4 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResults.cs @@ -11,14 +11,14 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger public sealed class TestResults { /// - /// constructor Class for testResults + /// Constructor Class for testResults /// public TestResults() { } /// - /// it has the test run summary of all test results + /// It has the test run summary of all test results /// [DataMember] internal TestRunSummary Summary { get; set; } @@ -27,7 +27,7 @@ public TestResults() /// List of Run Level Message that is Informational /// [DataMember] - internal List RunLevelMessageInformational = new List(); + internal List RunLevelMessageInformational = new List(); /// /// List of Run Level MessageError and warnings @@ -36,7 +36,7 @@ public TestResults() internal List RunLevelMessageErrorAndWarning = new List(); /// - /// List of all results in Hieracheal model + /// List of all results in Hierachal model /// [DataMember] internal List Results = new List(); @@ -47,7 +47,7 @@ public TestResults() /// internal int GetTestResultscount() { - return this.Results.Count; + return Results.Count; } } } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs similarity index 95% rename from src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs rename to src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs index 71da9d0c48..78dd2cabf7 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs @@ -5,7 +5,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger public class TestRunSummary { /// - /// total tests of a testrun + /// Total tests of a test run /// public int TotalTests { get; set; } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs similarity index 100% rename from src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs rename to src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Html.xslt new file mode 100644 index 0000000000..f225e90613 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Html.xslt @@ -0,0 +1,212 @@ + + + + + + +

TestResults

+ + + + + +
+ + + +

Results

+ +
+ + + + + + +
+

Summary

+ + + + +
+
+
+ + +
+
+ + +
+ +
+
+ + + + + + + + + +
+
+
+ + +
+
+ + +
+ +
+
+ + + + + + + + + +
+
+
+ + + ErrorMessage: + + +
+
+ + + ErrorStackTrace: + + +
+
+ + + + FailedTests:  + + + + +
+
+ + + + PassedTests:  + + + + +
+
+ + + + SkippedTests: + + + + +
+
+ + + + TotalTests:   + + + + +
+
+ + + DisplayName: + + +
+
+ + + + + ✔ + + + + + ✘ + + + + + + + + +
+
+ + + + + +
diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.Designer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Resources.Designer.cs similarity index 79% rename from src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.Designer.cs rename to src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Resources.Designer.cs index 6d3930e635..dbe68194a2 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.Resources { using System; @@ -39,7 +39,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.Resources.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; @@ -62,23 +62,30 @@ internal Resources() { /// /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> - ///<xsl:stylesheet version="2.0" - /// - /// xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" - /// xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - /// xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp" - ///> + ///<xsl:stylesheet version="2.0" + /// xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + /// xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + /// xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> /// <xsl:output method="html" indent="yes"/> /// <xsl:template match="/"> /// <html> /// <body> /// <h1>TestResults</h1> - /// <xsl:apply-templates [rest of string was truncated]";. + /// <xsl:apply-templates select ="/tp:TestResults"/> [rest of string was truncated]";. /// internal static string Html { get { return ResourceManager.GetString("Html", resourceCulture); } } + + /// + /// Looks up a localized string similar to Path to generated html test results file : {0}. + /// + internal static string HtmlFilePath { + get { + return ResourceManager.GetString("HtmlFilePath", resourceCulture); + } + } } } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.resx b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Resources.resx similarity index 96% rename from src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.resx rename to src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Resources.resx index 5f8e39a864..d93ad05628 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources.resx +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Resources.resx @@ -119,6 +119,9 @@ - Html.xslt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + html.xslt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + + Path to generated html test results file : {0} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf new file mode 100644 index 0000000000..37ad7298e8 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf new file mode 100644 index 0000000000..a8eb8b6cc7 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf new file mode 100644 index 0000000000..ea13cbd968 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf new file mode 100644 index 0000000000..1cbe8db38d --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf new file mode 100644 index 0000000000..3bdf08f07a --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf new file mode 100644 index 0000000000..b1d2688720 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf new file mode 100644 index 0000000000..d07e1689a9 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf new file mode 100644 index 0000000000..c4e8c3c438 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf new file mode 100644 index 0000000000..59f3c0518d --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf new file mode 100644 index 0000000000..6be5537af4 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf new file mode 100644 index 0000000000..e771b21219 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf new file mode 100644 index 0000000000..8849b35ba5 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf @@ -0,0 +1,441 @@ + + + + + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf new file mode 100644 index 0000000000..d5cb94a9ea --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf new file mode 100644 index 0000000000..1d86779d13 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf @@ -0,0 +1,459 @@ + + + +
+ + 27 + 22.95 + 22.95 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 27 + 0 + +
+ + + Path to generated html test results file : {0} + Obtained Html File's Path is {0} + + + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + <?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" + xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <h1>TestResults</h1> + <xsl:apply-templates select ="/tp:TestResults"/> + </body> + <script language="javascript"> + function ToggleClass(id) { + var elem = document.getElementById(id); + if (elem.style.display == "none") { + elem.style.display = "block"; + } + else { + elem.style.display = "none"; + } + } + </script> + <style> + #testtable { + border-collapse: collapse; + } + #testtable, th, td { + border: 1px solid black; + } + body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; } + h2 { + margin-top: 0; + } + .summary {background-color: #f4f4e1;font-family:monospace; } + .row { + background-color: #f0f5fa; + cursor:pointer; + width:100%; + } + .innerRow{ + background-color :#e9e1f4; + cursor:pointer; + width:100%; + } + .pass { color: #0c0; } + .fail { color: #c00; } + .errorMessage{ color : brown; } + .errorStackTrace{ color: brown; } + .duration{float:right;} + + </style> + </html> + </xsl:template> + + <xsl:template match="/tp:TestResults"> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary"/> + <h2>Results</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Results"/> + </xsl:template> + + <xsl:template match="/tp:TestResults/tp:Results"> + <xsl:apply-templates select ="/tp:TestResults/tp:Results/tp:TestResult"/> + </xsl:template> + + <xsl:template match="tp:TestResults/tp:Summary"> + <div class ="summary"> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> + </div> + </xsl:template> + + <xsl:template match="tp:TestResult"> + <div class ="row" onclick="ToggleClass('{generate-id()}')"> + <div > + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div class="duration"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match="tp:innerTestResults/tp:TestResult"> + <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > + <div> + <xsl:apply-templates select = "tp:resultOutcome" /> + <xsl:apply-templates select = "tp:FullyQualifiedName" /> + <div style="float:right;"> + <xsl:apply-templates select = "tp:Duration" /> + </div> + </div> + <xsl:if test ="tp:ErrorMessage!=''"> + <xsl:apply-templates select = "tp:ErrorMessage" /> + </xsl:if> + <xsl:if test ="tp:ErrorStackTrace!=''"> + <xsl:apply-templates select = "tp:ErrorStackTrace" /> + </xsl:if> + <xsl:if test ="tp:innerTestResults!=''"> + <a Id="{generate-id()}" style="display:none;"> + <h3>Child Test Results:</h3> + <xsl:apply-templates select = "tp:innerTestResults" /> + </a> + </xsl:if> + <br /> + </div> + </xsl:template> + + <xsl:template match = "tp:ErrorMessage"> + ErrorMessage: <span class="errorMessage"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:ErrorStackTrace"> + ErrorStackTrace: <span class="errorStackTrace"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:FailedTests"> + <span> + FailedTests:&#160; + </span> + <span class="failedTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:PassedTests"> + <span > + PassedTests:&#160; + </span> + <span class="passedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:SkippedTests"> + <span > + SkippedTests: + </span> + <span class="skippedTests" > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:TotalTests"> + <span > + TotalTests:&#160;&#160; + </span> + <span class="totalTests"> + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:DisplayName"> + DisplayName:<span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + + <xsl:template match = "tp:resultOutcome"> + <xsl:if test =" . = 'Passed' "> + <span class="pass"> + &#x2714; + </span> + </xsl:if> + <xsl:if test =" . = 'Failed'"> + <span class="fail"> + &#x2718; + </span> + </xsl:if> + </xsl:template> + + <xsl:template match = "tp:Duration"> + <span > + <xsl:value-of select = "." /> + </span> + <br /> + </xsl:template> + <xsl:template match = "tp:FullyQualifiedName"> + <span > + <xsl:value-of select = "." /> + </span> + </xsl:template> +</xsl:stylesheet> + + + + +
+
\ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/html.html b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/html.html deleted file mode 100644 index 248702c5db..0000000000 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/html.html +++ /dev/null @@ -1,58 +0,0 @@ - - -

TestResults

-

Summary

- TotalTests: - 6
- FailedTests: - 2
- PassedTests: - 4

Results

-

TestResult

-
-
PassedUnitTestProject3.UnitTest1.TestMethod1
- Duration:PT0.0058002S
-

- -
-
PassedUnitTestProject3.UnitTest2.TestMethod1
- Duration:PT0.000227S
-

-
-
PassedUnitTestProject3.UnitTest2.TestMethod2
- Duration:PT0.0000478S
-

- - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/sample.xml b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/sample.xml deleted file mode 100644 index 19165bd29a..0000000000 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/sample.xml +++ /dev/null @@ -1,2 +0,0 @@ -TestMethod1PT0.0058002SUnitTestProject3.UnitTest1.TestMethod1PassedTestMethod2PT1.288131SUnitTestProject3.UnitTest1.TestMethod2Sequential numbersPT1.2875673SAssert.AreEqual failed. Expected:<5>. Actual:<4>. at UnitTestProject3.UnitTest1.TestMethod2(Int32 a, Int32 b) in C:\Users\havineet\source\repos\UnitTestProject3\UnitTestProject3\UnitTest1.cs:line 19 -UnitTestProject3.UnitTest1.TestMethod2Failedequal numbersPT0.0000059SUnitTestProject3.UnitTest1.TestMethod2PassedFailedTestMethod1PT0.000227SUnitTestProject3.UnitTest2.TestMethod1PassedTestMethod2PT0.0000478SUnitTestProject3.UnitTest2.TestMethod2Passed246 \ No newline at end of file diff --git a/src/package/package/package.csproj b/src/package/package/package.csproj index 082f23c5fa..4b39d1211e 100644 --- a/src/package/package/package.csproj +++ b/src/package/package/package.csproj @@ -39,6 +39,7 @@ + true diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs index 7eb8b5e08b..21b80b8064 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs @@ -8,6 +8,7 @@ namespace Microsoft.TestPlatform.AcceptanceTests { using Microsoft.VisualStudio.TestTools.UnitTesting; + using System.Text; [TestClass] public class LoggerTests : AcceptanceTestBase @@ -32,6 +33,27 @@ public void TrxLoggerWithFriendlyNameShouldProperlyOverwriteFile(RunnerInfo runn Assert.IsTrue(IsValidXml(trxLogFilePath), "Invalid content in Trx log file"); } + [TestMethod] + [NetFullTargetFrameworkDataSource(inIsolation: true, inProcess: true)] + public void HtmlLoggerWithFriendlyNameShouldProperlyOverwriteFile(RunnerInfo runnerInfo) + { + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + + var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue, runnerInfo.InIsolationValue); + var htmlFileName = "TestResults.html"; + arguments = string.Concat(arguments, $" /logger:\"html;LogFileName={htmlFileName}\""); + this.InvokeVsTest(arguments); + + arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue, runnerInfo.InIsolationValue); + arguments = string.Concat(arguments, $" /logger:\"html;LogFileName={htmlFileName}\""); + arguments = string.Concat(arguments, " /testcasefilter:Name~Pass"); + this.InvokeVsTest(arguments); + + var htmlLogFilePath = Path.Combine(Directory.GetCurrentDirectory(), "TestResults", htmlFileName); + var expectedHtmlFilePath = @"D:\Code\vstest\test\Microsoft.TestPlatform.AcceptanceTests\TestResults.html"; + Assert.IsTrue(IsFileAndContentEqual(htmlLogFilePath, expectedHtmlFilePath), "Invalid content in Html log file"); + } + [TestMethod] [NetCoreTargetFrameworkDataSource] public void TrxLoggerWithExecutorUriShouldProperlyOverwriteFile(RunnerInfo runnerInfo) @@ -52,6 +74,27 @@ public void TrxLoggerWithExecutorUriShouldProperlyOverwriteFile(RunnerInfo runne Assert.IsTrue(IsValidXml(trxLogFilePath), "Invalid content in Trx log file"); } + [TestMethod] + [NetCoreTargetFrameworkDataSource] + public void HtmlLoggerWithExecutorUriShouldProperlyOverwriteFile(RunnerInfo runnerInfo) + { + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + + var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue, runnerInfo.InIsolationValue); + var htmlFileName = "TestResults.html"; + arguments = string.Concat(arguments, $" /logger:\"logger://Microsoft/TestPlatform/htmlLogger/v1;LogFileName{htmlFileName}\""); + this.InvokeVsTest(arguments); + + arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue, runnerInfo.InIsolationValue); + arguments = string.Concat(arguments, $" /logger:\"logger://Microsoft/TestPlatform/htmlLogger/v1;LogFileName={htmlFileName}\""); + arguments = string.Concat(arguments, " /testcasefilter:Name~Pass"); + this.InvokeVsTest(arguments); + + var htmlLogFilePath = Path.Combine(Directory.GetCurrentDirectory(), "TestResults", htmlFileName); + var expectedHtmlFilePath = @"D:\Code\vstest\test\Microsoft.TestPlatform.AcceptanceTests\TestResults.html"; + Assert.IsTrue(IsFileAndContentEqual(htmlLogFilePath, expectedHtmlFilePath), "Invalid content in Html log file"); + } + private bool IsValidXml(string xmlFilePath) { var reader = System.Xml.XmlReader.Create(File.OpenRead(xmlFilePath)); @@ -67,5 +110,28 @@ private bool IsValidXml(string xmlFilePath) return false; } } + + private bool IsFileAndContentEqual(string filePath,string expectedFilePath) + { + StringBuilder sb = new StringBuilder(); + using (var sr = new StreamReader(filePath)) + { + sb.Append(sr.ReadToEnd()); + } + string filePathContent = sb.ToString(); + + StringBuilder sbExpected = new StringBuilder(); + using (var sr = new StreamReader(filePath)) + { + sbExpected.Append(sr.ReadToEnd()); + } + + string expectedFilePathContent = sb.ToString(); + + if (expectedFilePathContent == filePathContent) + return true; + else + return false; + } } } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Microsoft.TestPlatform.AcceptanceTests.csproj b/test/Microsoft.TestPlatform.AcceptanceTests/Microsoft.TestPlatform.AcceptanceTests.csproj index a938d9ac78..928f62332f 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Microsoft.TestPlatform.AcceptanceTests.csproj +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Microsoft.TestPlatform.AcceptanceTests.csproj @@ -11,6 +11,7 @@ Microsoft.TestPlatform.AcceptanceTests + $(ChutzpahAdapterVersion) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TestResults.html b/test/Microsoft.TestPlatform.AcceptanceTests/TestResults.html new file mode 100644 index 0000000000..1cc7587dc5 --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TestResults.html @@ -0,0 +1,61 @@ + + +

TestResults

+
+

Summary

+ TotalTests:   + 1
+ FailedTests:  + 0
+ PassedTests:  + 1
+ SkippedTests: + 0

+

Results

+
+
+ ✔ + SampleUnitTestProject.UnitTest1.PassingTest
6ms
+

+ + \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj index 621dc40853..f4a541a1d3 100644 --- a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj @@ -10,7 +10,6 @@ Exe netcoreapp2.1;net451 - From 29aed06b1e163cce0efb1088669465337c486114 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Fri, 9 Aug 2019 10:18:21 +0530 Subject: [PATCH 05/20] incresed the file count in Tesplatform.portable and Testplatform nuspec files --- .../nuspec/Microsoft.TestPlatform.Portable.nuspec | 14 ++++++++++++++ src/package/nuspec/Microsoft.TestPlatform.nuspec | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec b/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec index 81d63e9f40..a85e963bf6 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec +++ b/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec @@ -90,6 +90,20 @@ + + + + + + + + + + + + + + diff --git a/src/package/nuspec/Microsoft.TestPlatform.nuspec b/src/package/nuspec/Microsoft.TestPlatform.nuspec index de164d2d71..7401293268 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.nuspec +++ b/src/package/nuspec/Microsoft.TestPlatform.nuspec @@ -187,6 +187,7 @@ + @@ -199,6 +200,7 @@ + @@ -211,6 +213,7 @@ + @@ -223,6 +226,7 @@ + @@ -277,6 +281,7 @@ + @@ -289,6 +294,7 @@ + @@ -301,6 +307,7 @@ + @@ -313,6 +320,7 @@ + @@ -325,6 +333,7 @@ + @@ -337,6 +346,7 @@ + @@ -349,6 +359,7 @@ + @@ -361,6 +372,7 @@ + @@ -377,6 +389,7 @@ + @@ -389,6 +402,7 @@ + From 49ee322ec5c4b2b8e93ee490020e32e11bed0820 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Fri, 9 Aug 2019 10:55:55 +0530 Subject: [PATCH 06/20] Adding xlf files --- scripts/build.ps1 | 6 ++- scripts/verify-nupkgs.ps1 | 6 +-- .../Html.xslt | 40 +++++++++---------- .../HtmlTransformer.cs | 2 +- .../Resources/Html.xslt | 40 +++++++++---------- .../Resources/xlf/Resources.cs.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.de.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.es.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.fr.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.it.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.ja.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.ko.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.pl.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.pt-BR.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.ru.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.tr.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.zh-Hans.xlf | 40 +++++++++---------- .../Resources/xlf/Resources.zh-Hant.xlf | 40 +++++++++---------- 19 files changed, 328 insertions(+), 326 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index c68528a0ed..032a0e57f4 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -298,7 +298,7 @@ function Publish-Package # If there are some dependencies for the logger assemblies, those need to be moved too. # Ideally we should just be publishing the loggers to the Extensions folder. - $loggers = @("Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll", "Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.pdb") + $loggers = @("Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll", "Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.pdb", "Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.dll", "Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.pdb") foreach($file in $loggers) { Write-Verbose "Move-Item $fullCLRPackageDir\$file $fullCLRExtensionsDir -Force" Move-Item $fullCLRPackageDir\$file $fullCLRExtensionsDir -Force @@ -311,6 +311,8 @@ function Publish-Package if($TPB_LocalizedBuild) { Move-Loc-Files $fullCLRPackageDir $fullCLRExtensionsDir "Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.resources.dll" Move-Loc-Files $coreCLR20PackageDir $coreCLRExtensionsDir "Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.resources.dll" + Move-Loc-Files $fullCLRPackageDir $fullCLRExtensionsDir "Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.resources.dll" + Move-Loc-Files $coreCLR20PackageDir $coreCLRExtensionsDir "Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.resources.dll" } # Copy Blame Datacollector to Extensions folder. @@ -867,7 +869,7 @@ Write-Log "Test platform environment variables: " Get-ChildItem env: | Where-Object -FilterScript { $_.Name.StartsWith("TP_") } | Format-Table Write-Log "Test platform build variables: " Get-Variable | Where-Object -FilterScript { $_.Name.StartsWith("TPB_") } | Format-Table -Install-DotNetCli +#Install-DotNetCli Restore-Package Update-LocalizedResources Invoke-Build diff --git a/scripts/verify-nupkgs.ps1 b/scripts/verify-nupkgs.ps1 index 84ed4d6a4e..f62fe3ae46 100644 --- a/scripts/verify-nupkgs.ps1 +++ b/scripts/verify-nupkgs.ps1 @@ -14,12 +14,12 @@ function Verify-Nuget-Packages($packageDirectory) Write-Log "Starting Verify-Nuget-Packages." $expectedNumOfFiles = @{"Microsoft.CodeCoverage" = 29; "Microsoft.NET.Test.Sdk" = 13; - "Microsoft.TestPlatform" = 422; + "Microsoft.TestPlatform" = 436; "Microsoft.TestPlatform.Build" = 19; - "Microsoft.TestPlatform.CLI" = 301; + "Microsoft.TestPlatform.CLI" = 315; "Microsoft.TestPlatform.Extensions.TrxLogger" = 33; "Microsoft.TestPlatform.ObjectModel" = 62; - "Microsoft.TestPlatform.Portable" = 471; + "Microsoft.TestPlatform.Portable" = 485; "Microsoft.TestPlatform.TestHost" = 140; "Microsoft.TestPlatform.TranslationLayer" = 121} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt index f225e90613..e7d3dedd26 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt @@ -1,5 +1,5 @@  - @@ -36,7 +36,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -65,15 +65,15 @@
-

Summary

- - - - -
+

Summary

+ + + + +
- +
@@ -98,7 +98,7 @@
- +
@@ -123,21 +123,21 @@
- + ErrorMessage:
- + ErrorStackTrace:
- + FailedTests:  @@ -147,7 +147,7 @@
- + PassedTests:  @@ -157,7 +157,7 @@
- + SkippedTests: @@ -167,24 +167,24 @@
- + TotalTests:   - +
- + DisplayName:
- + @@ -197,7 +197,7 @@ - + diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs index 5627bf4569..941d2661f3 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs @@ -10,7 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger class HtmlTransformer : IHtmlTransformer { - StringReader xsltStringReader = new StringReader(@"D:\Code\vstest\src\Microsoft.TestPlatform.Extensions.HtmlLogger\Html.xslt");//HtmlResources.Html); + StringReader xsltStringReader = new StringReader(HtmlResources.Html); XslCompiledTransform myXslTransform; /// diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Html.xslt index f225e90613..e7d3dedd26 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Html.xslt +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/Html.xslt @@ -1,5 +1,5 @@  - @@ -36,7 +36,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -65,15 +65,15 @@
-

Summary

- - - - -
+

Summary

+ + + + +
- +
@@ -98,7 +98,7 @@
- +
@@ -123,21 +123,21 @@
- + ErrorMessage:
- + ErrorStackTrace:
- + FailedTests:  @@ -147,7 +147,7 @@
- + PassedTests:  @@ -157,7 +157,7 @@
- + SkippedTests: @@ -167,24 +167,24 @@
- + TotalTests:   - +
- + DisplayName:
- + @@ -197,7 +197,7 @@ - + diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf index 37ad7298e8..28d5860f8c 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf index a8eb8b6cc7..2e0749c8b0 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf index ea13cbd968..6d874d3483 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf index 1cbe8db38d..ee1c3dd6cf 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf index 3bdf08f07a..7cfac7a8be 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf index b1d2688720..8fee1e14c7 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf index d07e1689a9..f91479cead 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf index c4e8c3c438..6db6f7ba53 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf index 59f3c0518d..33884cc28f 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf index 6be5537af4..79e3526cd3 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf index e771b21219..e002cea6eb 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf index 8849b35ba5..82fdc8cfae 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf @@ -9,7 +9,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -46,7 +46,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -75,15 +75,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -108,7 +108,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -133,21 +133,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -157,7 +157,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -167,7 +167,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -177,24 +177,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -207,7 +207,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf index d5cb94a9ea..0cfcdd45df 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf index 1d86779d13..05d23abc85 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf @@ -27,7 +27,7 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="2.0" +<xsl:stylesheet version="2.0" xmlns:tp="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs tp"> @@ -64,7 +64,7 @@ .row { background-color: #f0f5fa; cursor:pointer; - width:100%; + width:100%; } .innerRow{ background-color :#e9e1f4; @@ -93,15 +93,15 @@ <xsl:template match="tp:TestResults/tp:Summary"> <div class ="summary"> - <h2>Summary</h2> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> - <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> - <br/> + <h2>Summary</h2> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:TotalTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:FailedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:PassedTests"/> + <xsl:apply-templates select ="/tp:TestResults/tp:Summary/tp:SkippedTests"/> + <br/> </div> </xsl:template> - + <xsl:template match="tp:TestResult"> <div class ="row" onclick="ToggleClass('{generate-id()}')"> <div > @@ -126,7 +126,7 @@ <br /> </div> </xsl:template> - + <xsl:template match="tp:innerTestResults/tp:TestResult"> <div class="innerRow" onclick="ToggleClass('{generate-id()}')" > <div> @@ -151,21 +151,21 @@ <br /> </div> </xsl:template> - + <xsl:template match = "tp:ErrorMessage"> ErrorMessage: <span class="errorMessage"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:ErrorStackTrace"> ErrorStackTrace: <span class="errorStackTrace"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:FailedTests"> <span> FailedTests:&#160; @@ -175,7 +175,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:PassedTests"> <span > PassedTests:&#160; @@ -185,7 +185,7 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:SkippedTests"> <span > SkippedTests: @@ -195,24 +195,24 @@ </span> <br /> </xsl:template> - + <xsl:template match = "tp:TotalTests"> <span > TotalTests:&#160;&#160; - </span> + </span> <span class="totalTests"> <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:DisplayName"> DisplayName:<span > <xsl:value-of select = "." /> </span> <br /> </xsl:template> - + <xsl:template match = "tp:resultOutcome"> <xsl:if test =" . = 'Passed' "> <span class="pass"> @@ -225,7 +225,7 @@ </span> </xsl:if> </xsl:template> - + <xsl:template match = "tp:Duration"> <span > <xsl:value-of select = "." /> From e34d3dfd902efff64fda221fec402fbdb2bef88b Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Fri, 9 Aug 2019 11:03:25 +0530 Subject: [PATCH 07/20] Added installing dotnet-cli in build --- scripts/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 032a0e57f4..d7aa8ef4fd 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -869,7 +869,7 @@ Write-Log "Test platform environment variables: " Get-ChildItem env: | Where-Object -FilterScript { $_.Name.StartsWith("TP_") } | Format-Table Write-Log "Test platform build variables: " Get-Variable | Where-Object -FilterScript { $_.Name.StartsWith("TPB_") } | Format-Table -#Install-DotNetCli +Install-DotNetCli Restore-Package Update-LocalizedResources Invoke-Build From 203a717b6161e4e2399f7295764c8cb365d0086f Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Fri, 9 Aug 2019 12:27:10 +0530 Subject: [PATCH 08/20] Corrected defaultParamter:Logfile on HtmlLoggerTests --- .../HtmlLoggerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs index bc09f77677..58160c891c 100644 --- a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs @@ -27,7 +27,7 @@ public class HtmlLoggerTests private Htmllogger htmlLogger; private Dictionary parameters; private static string DefaultTestRunDirectory = Path.GetTempPath(); - private static string DefaultLogFileNameParameterValue = "logfilevalue.trx"; + private static string DefaultLogFileNameParameterValue = "logfilevalue.html"; private Mock mockFileHelper; private Mock mockXmlSerializer ; From 62011eeb81ae4a18dd5dca9549ae75af2568f16f Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Fri, 9 Aug 2019 15:41:49 +0530 Subject: [PATCH 09/20] Changed the hardcoded folder name of testresults --- TestPlatform.sln | 3 +++ test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs | 2 +- .../Microsoft.TestPlatform.AcceptanceTests/TestResults.html | 6 ++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/TestPlatform.sln b/TestPlatform.sln index fb47dab9d9..2e140d8990 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -42,6 +42,9 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Integration", "Integration", "{46250E12-4CF1-4051-B4A7-80C8C06E0068}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Logger", "Logger", "{020E15EA-731F-4667-95AF-226671E0C3AE}" + ProjectSection(SolutionItems) = preProject + test\Microsoft.TestPlatform.AcceptanceTests\TestResults.html = test\Microsoft.TestPlatform.AcceptanceTests\TestResults.html + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Performance", "Performance", "{595BE9C1-E10F-4E50-938A-E6C248D3F950}" EndProject diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs index 21b80b8064..0a36b616d4 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs @@ -50,7 +50,7 @@ public void HtmlLoggerWithFriendlyNameShouldProperlyOverwriteFile(RunnerInfo run this.InvokeVsTest(arguments); var htmlLogFilePath = Path.Combine(Directory.GetCurrentDirectory(), "TestResults", htmlFileName); - var expectedHtmlFilePath = @"D:\Code\vstest\test\Microsoft.TestPlatform.AcceptanceTests\TestResults.html"; + var expectedHtmlFilePath = @".\TestResults.html"; Assert.IsTrue(IsFileAndContentEqual(htmlLogFilePath, expectedHtmlFilePath), "Invalid content in Html log file"); } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TestResults.html b/test/Microsoft.TestPlatform.AcceptanceTests/TestResults.html index 1cc7587dc5..fe5d919771 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TestResults.html +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TestResults.html @@ -4,7 +4,7 @@

TestResults

Summary

TotalTests:   - 1
+ 1
FailedTests:  0
PassedTests:  @@ -15,7 +15,7 @@

Results

✔ - SampleUnitTestProject.UnitTest1.PassingTest
6ms
+ SampleUnitTestProject.UnitTest1.PassingTest
7ms

@@ -91,7 +87,6 @@ @@ -104,7 +99,7 @@
-
+
@@ -116,7 +111,6 @@ @@ -125,6 +119,7 @@ +    ErrorMessage: @@ -132,6 +127,7 @@ +    ErrorStackTrace: diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs index 4d675760e7..c32b91408d 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs @@ -35,7 +35,7 @@ public class Htmllogger : ITestLoggerWithParameters private Dictionary parametersDictionary; public Htmllogger() - : this(new FileHelper(), new HtmlTransformer(), new DataContractSerializer(typeof(TestResults))) + : this(new FileHelper(), new HtmlTransformer(), new DataContractSerializer(typeof(TestRunDetails))) { } @@ -61,7 +61,7 @@ public Htmllogger(IFileHelper filehelper, IHtmlTransformer htmlTransformer, XmlO /// /// TestResults Stores all the Summary and the details of evrey Results in Hiearachial order. /// - public TestResults TestResults { get; private set; } + public TestRunDetails TestResults { get; private set; } /// /// Total Passed Tests in the TestResults @@ -103,7 +103,7 @@ public void Initialize(TestLoggerEvents events, string TestResultsDirPath) events.TestRunComplete += this.TestRunCompleteHandler; this.TestResultsDirPath = TestResultsDirPath; - this.TestResults = new TestResults(); + this.TestResults = new TestRunDetails(); this.Results = new ConcurrentDictionary(); } @@ -145,7 +145,7 @@ internal void TestMessageHandler(object sender, TestRunMessageEventArgs e) TestResults.RunLevelMessageErrorAndWarning.Add(e.Message); break; default: - Debug.Fail("htmlLogger.TestMessageHandler: The test message level is unrecognized: {0}", e.Level.ToString()); + EqtTrace.Info("htmlLogger.TestMessageHandler: The test message level is unrecognized: {0}", e.Level.ToString()); break; } } @@ -201,13 +201,13 @@ internal void TestResultHandler(object sender, TestResultEventArgs e) private void AddToParentResult( Guid parentExecutionId, TestResult testResult) { // Needs to be tested! - TestResult ParentTestResult; - this.Results.TryGetValue(parentExecutionId, out ParentTestResult); + TestResult parentTestResult; + this.Results.TryGetValue(parentExecutionId, out parentTestResult); - if (ParentTestResult.innerTestResults == null) - ParentTestResult.innerTestResults = new List(); + if (parentTestResult.innerTestResults == null) + parentTestResult.innerTestResults = new List(); - ParentTestResult.innerTestResults.Add(testResult); + parentTestResult.innerTestResults.Add(testResult); } /// @@ -238,8 +238,8 @@ internal void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) private void PopulateHtmlFile() { - fileName = String.Format(CultureInfo.CurrentCulture, "{0}_{1}_{2}", Environment.GetEnvironmentVariable("UserName"), Environment.MachineName, FormatDateTimeForRunName(DateTime.Now)); - XmlFilePath = this.GetFilePath("xml",this.fileName); + this.fileName = String.Format(CultureInfo.CurrentCulture, "{0}_{1}_{2}", Environment.GetEnvironmentVariable("UserName"), Environment.MachineName, FormatDateTimeForRunName(DateTime.Now)); + XmlFilePath = this.GetFilePath(HtmlLoggerConstants.Xml,this.fileName); Stream xmlStream = null; try @@ -248,26 +248,24 @@ private void PopulateHtmlFile() xmlSerializer.WriteObject(xmlStream, TestResults); xmlStream.Close(); - if (HtmlFilePath == null) + if (string.IsNullOrEmpty(HtmlFilePath)) { - HtmlFilePath = this.GetFilePath("html", this.fileName); + HtmlFilePath = this.GetFilePath(HtmlLoggerConstants.Html, this.fileName); } htmlTransformer.Transform(XmlFilePath, HtmlFilePath); } catch (IOException ioEx) { - string ioexMessage = string.Format("HtmlLogger : Failed to create a xml file. Exception : {0}", ioEx.ToString()); - EqtTrace.Error(ioexMessage); + EqtTrace.Error(string.Format("HtmlLogger : Failed to create a xml file. Exception : {0}", ioEx.ToString())); } catch (XsltCompileException xslte) { - string xslteMessage = string.Format("HtmlLogger : Failed to convert xml file to html file. Exception : {0}", xslte.ToString()); - EqtTrace.Error(xslteMessage); + EqtTrace.Error(string.Format("HtmlLogger : Failed to convert xml file to html file. Exception : {0}", xslte.ToString())); } string htmlfilePathMessage = string.Format(CultureInfo.CurrentCulture, HtmlResource.HtmlFilePath, HtmlFilePath); EqtTrace.Info(htmlfilePathMessage); - ConsoleOutput.Instance.Information(false, HtmlFilePath); + ConsoleOutput.Instance.Information(false, htmlfilePathMessage); } private string GetFilePath(string fileFormat,string FileName) diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs index bfe5d971f3..dbba6abe80 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs @@ -3,23 +3,21 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { - using System.IO; using System.Xml; using System.Xml.Xsl; using HtmlResources = Resources.Resources; class HtmlTransformer : IHtmlTransformer { - StringReader xsltStringReader = new StringReader("html.xslt"); - XslCompiledTransform myXslTransform; + XslCompiledTransform xslTransform; /// /// The following function invokes the compiled tranform and Loads the xslt file. /// public HtmlTransformer() { - myXslTransform = new XslCompiledTransform(); - myXslTransform.Load(XmlReader.Create(xsltStringReader)); + xslTransform = new XslCompiledTransform(); + xslTransform.Load(XmlReader.Create(this.GetType().Assembly.GetManifestResourceStream("Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.Html.xslt"))); } /// @@ -27,7 +25,7 @@ public HtmlTransformer() /// public void Transform(string xmlfile, string htmlfile) { - myXslTransform.Transform(xmlfile, htmlfile); + xslTransform.Transform(xmlfile, htmlfile); } } } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj index df78c90b47..9025a0d8c1 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResults.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs similarity index 95% rename from src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResults.cs rename to src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs index dccd2e85f4..1c61e1c635 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResults.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs @@ -8,12 +8,12 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { [DataContract] [KnownType(typeof(TestResult))] - public sealed class TestResults + public sealed class TestRunDetails { /// /// Constructor Class for testResults /// - public TestResults() + public TestRunDetails() { } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs index 78dd2cabf7..1c4aeb8316 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. + namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { public class TestRunSummary diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf index b273dc36e9..a56978a9ee 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.cs.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf index bf4efb143f..5ff9cfca7f 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.de.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf index a8641bca3d..fe7cdbe5db 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.es.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf index 1445b11507..93bddc0de2 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.fr.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf index b3341aba3e..ab6dbcd720 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.it.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf index 2dbb73f06f..896b79f62d 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ja.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf index 16df6f68c1..92f75efbc2 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ko.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf index 1db9c1341e..92c1eb2c85 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pl.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf index 52e817d5cf..34172d94cc 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.pt-BR.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf index 7317d6c537..b4629668c5 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.ru.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf index 5c2f77585e..c5e02cd5dd 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.tr.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf index 2fa7ff50ea..9c1fa7577b 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.xlf @@ -3,7 +3,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf index a50cac652b..f12b190c4e 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hans.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf index 0f60eb7dea..e2b04eaeb2 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Resources/xlf/Resources.zh-Hant.xlf @@ -21,7 +21,7 @@ - Path to generated html test results file : {0} + Html test results file : {0} Obtained Html File's Path is {0} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs index e804761a5f..a71c72f75b 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Utility/Constants.cs @@ -47,13 +47,13 @@ internal static class Constants /// public const string LogFileNameKey = "LogFileName"; - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] + // [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty ExecutionIdProperty = TestProperty.Register("ExecutionId", ExecutionIdPropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(VisualStudio.TestPlatform.ObjectModel.TestResult)); - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] + // [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty ParentExecIdProperty = TestProperty.Register("ParentExecId", ParentExecutionIdPropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(VisualStudio.TestPlatform.ObjectModel.TestResult)); - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] + // [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty TestTypeProperty = TestProperty.Register("TestType", TestTypePropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(VisualStudio.TestPlatform.ObjectModel.TestResult)); } } \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs index bf049f9f82..e81fc86ad9 100644 --- a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs @@ -392,7 +392,7 @@ public void TestCompleteHandlerShouldWriteToXmlSerializerCorrectly() this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); - this.mockXmlSerializer.Verify(x => x.WriteObject(It.IsAny(), It.IsAny()), Times.Once); + this.mockXmlSerializer.Verify(x => x.WriteObject(It.IsAny(), It.IsAny()), Times.Once); Assert.IsTrue(htmlLogger.XmlFilePath.Contains(".xml")); Assert.IsTrue(htmlLogger.HtmlFilePath.Contains(".html")); } @@ -406,9 +406,9 @@ private HtmlLogger.TestResult CreateTestResult(TestOutcome testoutcome, string d return testResult; } - private TestResults CreateTestResults() + private TestRunDetails CreateTestResults() { - TestResults testresults = new TestResults(); + TestRunDetails testresults = new TestRunDetails(); return testresults; } From b29505ca6fa8ec9f93dff047b2671d5168864a85 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Tue, 13 Aug 2019 18:26:05 +0530 Subject: [PATCH 12/20] TestResults changed to TestRunDetails and summary comments corrected --- .../Html.xslt | 34 ++++++++-------- .../HtmlLogger.cs | 38 +++++++++--------- .../ObjectModel/TestRunDetails.cs | 18 ++++----- .../ObjectModel/TestRunSummary.cs | 8 ++-- .../ObjectModel/Testresult.cs | 26 ++++++------ .../Utility/Constants.cs | 3 -- .../HtmlLoggerTests.cs | 40 +------------------ ...orm.Extensions.HtmlLogger.UnitTests.csproj | 3 +- 8 files changed, 64 insertions(+), 106 deletions(-) diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt index 4f5f3d2846..34871a6510 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt @@ -7,8 +7,8 @@ -

TestResults

- +

TestRunDetails

+ - - -
- - - -

Results

- -
- - - - - - -
-

Summary

- - - - -
-
-
- - -
-
- - -
- -
-
- - - - - - - - - -
-
-
- - -
-
- - -
- -
-
- - - - - - - - - -
-
-
- - - ErrorMessage: - - -
-
- - - ErrorStackTrace: - - -
-
- - - - FailedTests:  - - - - -
-
- - - - PassedTests:  - - - - -
-
- - - - SkippedTests: - - - - -
-
- - - - TotalTests:   - - - - -
-
- - - DisplayName: - - -
-
- - - - - ✔ - - - - - ✘ - - - - - - - - -
-
- - - - - - diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs index ebe6bf5912..2a14fa1af3 100644 --- a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs @@ -66,7 +66,7 @@ public void InitializeShouldInitializeAllProperties() this.htmlLogger.Initialize(events.Object, testResultDir); Assert.AreEqual(this.htmlLogger.TestResultsDirPath, testResultDir); - Assert.IsNotNull(this.htmlLogger.TestResults); + Assert.IsNotNull(this.htmlLogger.TestRunDetails); Assert.IsNotNull(this.htmlLogger.Results); } @@ -106,7 +106,7 @@ public void TestMessageHandlerShouldAddMessageWhenItIsInformation() this.htmlLogger.TestMessageHandler(new object(), trme); - string actualMessage = this.htmlLogger.TestResults.RunLevelMessageInformational.First(); + string actualMessage = this.htmlLogger.TestRunDetails.RunLevelMessageInformational.First(); Assert.AreEqual(message, actualMessage.ToString()); } @@ -121,8 +121,8 @@ public void TestMessageHandlerShouldAddMessageInListIfItIsWarningAndError() TestRunMessageEventArgs trme2 = new TestRunMessageEventArgs(TestMessageLevel.Warning, message2); this.htmlLogger.TestMessageHandler(new object(), trme2); - Assert.AreEqual(message, this.htmlLogger.TestResults.RunLevelMessageErrorAndWarning.First()); - Assert.AreEqual(2, this.htmlLogger.TestResults.RunLevelMessageErrorAndWarning.Count()); + Assert.AreEqual(message, this.htmlLogger.TestRunDetails.RunLevelMessageErrorAndWarning.First()); + Assert.AreEqual(2, this.htmlLogger.TestRunDetails.RunLevelMessageErrorAndWarning.Count()); } [TestMethod] @@ -179,7 +179,7 @@ public void TestResultHandlerShouldSetDisplayNameIfNullProperly() passTestResultActual.resultOutcome = TestOutcome.Passed; passTestResultActual.DisplayName = "abc"; - Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestResults.Results.First().DisplayName); + Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestRunDetails.Results.First().DisplayName); TestCase passTestCase2 = CreateTestCase("Pass1"); ObjectModel.TestResult PassTestResultExpected1 = new ObjectModel.TestResult(passTestCase1); @@ -193,7 +193,7 @@ public void TestResultHandlerShouldSetDisplayNameIfNullProperly() passTestResultActual.resultOutcome = TestOutcome.Passed; passTestResultActual.DisplayName = "def"; - Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestResults.Results.Last().DisplayName); + Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestRunDetails.Results.Last().DisplayName); } [TestMethod] @@ -215,7 +215,7 @@ public void TestResultHandlerShouldCreateTestResultProperly() this.htmlLogger.TestResultHandler(new object(), eventArg.Object); - var result = this.htmlLogger.TestResults.Results.First(); + var result = this.htmlLogger.TestRunDetails.Results.First(); Assert.AreEqual(result.DisplayName, "def"); Assert.AreEqual(result.ErrorMessage, "error message"); @@ -242,7 +242,7 @@ public void TestResultHandlerShouldCreateOneTestEntryForEachTestCase() this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); - Assert.AreEqual(this.htmlLogger.TestResults.GetTestResultscount(), 2, "TestResultHandler is not creating test result entry for each test case"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.GetTestResultscount(), 2, "TestResultHandler is not creating test result entry for each test case"); } [TestMethod] @@ -262,8 +262,8 @@ public void TestResultHandlerShouldAddHierarchicalResultsForOrderedTest() this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); - Assert.AreEqual(this.htmlLogger.TestResults.GetTestResultscount(), 1, "testhandler is adding parent result correctly"); - Assert.IsNull(this.htmlLogger.TestResults.Results[0].innerTestResults, "testhandler is adding child result correctly"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.GetTestResultscount(), 1, "testhandler is adding parent result correctly"); + Assert.IsNull(this.htmlLogger.TestRunDetails.Results[0].innerTestResults, "testhandler is adding child result correctly"); ObjectModel.TestResult result2 = new ObjectModel.TestResult(testCase2); result2.SetPropertyValue(HtmlLoggerConstants.ExecutionIdProperty, Guid.NewGuid()); @@ -280,8 +280,8 @@ public void TestResultHandlerShouldAddHierarchicalResultsForOrderedTest() this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); this.htmlLogger.TestResultHandler(new object(), resultEventArg3.Object); - Assert.AreEqual(this.htmlLogger.TestResults.GetTestResultscount(), 1, "testhandler is adding parent result correctly"); - Assert.AreEqual(this.htmlLogger.TestResults.Results[0].GetInnerTestResultscount(), 2, "testhandler is adding child result correctly"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.GetTestResultscount(), 1, "testhandler is adding parent result correctly"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Results[0].GetInnerTestResultscount(), 2, "testhandler is adding child result correctly"); } [TestMethod] @@ -320,9 +320,12 @@ public void TestCompleteHandlerShouldKeepTackOfSummary() this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); - Assert.AreEqual(this.htmlLogger.TestResults.Summary.TotalTests, 4, "summary should keep track of totaltests"); - Assert.AreEqual(this.htmlLogger.TestResults.Summary.FailedTests, 1, "summary should keep track of failedtests"); - Assert.AreEqual(this.htmlLogger.TestResults.Summary.PassedTests, 2, "summary should keep track of passedtests"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Summary.TotalTests, 4, "summary should keep track of totaltests"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Summary.FailedTests, 1, "summary should keep track of failedtests"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Summary.PassedTests, 2, "summary should keep track of passedtests"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Summary.SkippedTests, 1, "summary should keep track of passedtests"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Summary.PassPercentage, 50, "summary should keep track of passedtests"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Summary.TotalRunTime, null , "summary should keep track of passedtests"); } [TestMethod] From 7fdf5e452c3c3a427b28d4d7ebcc0eaeb433a435 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Mon, 19 Aug 2019 22:14:35 +0530 Subject: [PATCH 14/20] redundant code in xslt is removed and acceptanece test is corrected --- .../Html.xslt | 212 ++++-------------- .../HtmlLogger.cs | 8 +- .../ObjectModel/TestRunDetails.cs | 17 +- .../ObjectModel/TestRunSummary.cs | 1 + .../ObjectModel/Testresult.cs | 42 +--- .../LoggerTests.cs | 24 +- .../HtmlLoggerTests.cs | 38 +++- 7 files changed, 105 insertions(+), 237 deletions(-) diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt index 2fd3064685..04e44f1f53 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt @@ -34,13 +34,16 @@ flex-wrap: wrap; } .row { - border: 3px solid #ffffff; + border: 2px solid #ffffff; width:100%; + cursor:pointer; + background-color:#bcdaf7; } .innerRow{ border: 2px solid #ffffff; padding-left:1%; margin-left:1%; + background-color:#ffffff; } .block{ width : 150px; @@ -50,7 +53,8 @@ background-color:#bcdaf7; } .innerDivision{ - background-color:#f0f5fa; + border: 2px solid #ffffff; + background-color:#e0f0ff; } .pass { color: #0c0; } .fail { color: #c00; } @@ -70,10 +74,6 @@ - - - -
@@ -94,199 +94,79 @@
- -
- -
-
- - -
- -
-
- - - - - - -
-
- - -
-
- - -
- -
-
- - - - - - -
-
-
- - - + + - -
- -
-
- - -
- -
-
- - - - - - -
-
+ + +
+ +
+ + +
+
+ +
+ + +
+
- -
-
- - -
- -
-
- - - - - - -
-
+ +
+ + +
- - - + +
- + -    - Error: - - -
+     Error:
-    - Stack trace: - - -
+     Stack trace:
- - Failed  :  - - - - -
+ Failed  : 
- - Passed  :  - - - - -
+ Passed  : 
- - Skipped :  - - - - -
+ Skipped : 
- - Total tests - -
- -
-
+ Total tests

- - Run duration - -
- -
-
+ Run duration

- - Pass percentage - -
- % -
-
+ Pass percentage
%

- - - - ✔ - - - - - ✘ - - - - - ! - - + + + + ! - - - -
+
+ - - - +   diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs index efdf2f2e41..30263255c0 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs @@ -175,7 +175,7 @@ internal void TestResultHandler(object sender, TestResultEventArgs e) var parentExecutionId = this.GetParentExecutionId(e.Result); this.TotalTests++; - testResult.resultOutcome = e.Result.Outcome; + testResult.ResultOutcome = e.Result.Outcome; if (e.Result.Outcome == TestOutcome.Failed) { this.FailedTests++; @@ -206,10 +206,10 @@ private void AddToParentResult( Guid parentExecutionId, TestResult testResult) TestResult parentTestResult; this.Results.TryGetValue(parentExecutionId, out parentTestResult); - if (parentTestResult.innerTestResults == null) - parentTestResult.innerTestResults = new List(); + if (parentTestResult.InnerTestResults == null) + parentTestResult.InnerTestResults = new List(); - parentTestResult.innerTestResults.Add(testResult); + parentTestResult.InnerTestResults.Add(testResult); } /// diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs index 546496d0e5..b639795a0b 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs @@ -18,36 +18,27 @@ public TestRunDetails() } /// - /// It has the test run summary of all TestResults. + /// Test run summary of all test results. /// [DataMember] internal TestRunSummary Summary { get; set; } /// - /// List of Run level message that is Informational. + /// List of informational run level messages. /// [DataMember] internal List RunLevelMessageInformational = new List(); /// - /// List of Run level message error and warnings + /// List of error and warning messages /// [DataMember] internal List RunLevelMessageErrorAndWarning = new List(); /// - /// List of all results in hierarchical model. + /// List of all the results /// [DataMember] internal List Results = new List(); - - /// - /// Gives the count of elements that Present in the results list. - /// - /// - internal int GetTestResultscount() - { - return Results.Count; - } } } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs index c0b4cd2b63..b10df8d273 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs @@ -16,6 +16,7 @@ public class TestRunSummary /// Total test run time. /// public string TotalRunTime { get; set; } + /// /// Total tests of a test run. /// diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs index e8440dfc21..b0de51fcc6 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs @@ -10,29 +10,29 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger public class TestResult { /// - /// Fully Qualified name of TestResult. + /// Fully qualified name of the Test Result. /// - public string FullyQualifiedName; + public string FullyQualifiedName { get; set; } /// - /// DisplayName for the Particular TestResult.It is unique for each TestResult. + /// Display Name for the particular Test Result /// - public string DisplayName; + public string DisplayName { get; set; } /// - /// The error stack trace of the TestResult. + /// The error stack trace of the Test Result. /// - public string ErrorStackTrace; + public string ErrorStackTrace { get; set; } /// - /// Error message of the TestResult. + /// Error message of the Test Result. /// - public string ErrorMessage; + public string ErrorMessage { get; set; } /// - /// It is enum whether the TestResult is passed failed or skipped. + /// Enum that deteremines the outcome of the test case /// - public TestOutcome resultOutcome; + public TestOutcome ResultOutcome { get; set; } /// /// Total timespan of the TestResult @@ -40,26 +40,8 @@ public class TestResult public string Duration { get; set; } /// - /// The list of TestResults that are children to the current TestResult. + /// The list of TestResults that are children to the current Test Result. /// - public List innerTestResults; - - /// - /// Get the count of inner TestResults count. - /// - /// - internal int GetInnerTestResultscount() - { - return this.innerTestResults.Count; - } - - /// - /// Gives the current TestResult. - /// - /// - internal TestResult GetTestResult() - { - return this; - } + public List InnerTestResults { get; set; } } } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs index 0a36b616d4..60fd2fce25 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs @@ -50,8 +50,7 @@ public void HtmlLoggerWithFriendlyNameShouldProperlyOverwriteFile(RunnerInfo run this.InvokeVsTest(arguments); var htmlLogFilePath = Path.Combine(Directory.GetCurrentDirectory(), "TestResults", htmlFileName); - var expectedHtmlFilePath = @".\TestResults.html"; - Assert.IsTrue(IsFileAndContentEqual(htmlLogFilePath, expectedHtmlFilePath), "Invalid content in Html log file"); + IsFileAndContentEqual(htmlLogFilePath); } [TestMethod] @@ -91,8 +90,8 @@ public void HtmlLoggerWithExecutorUriShouldProperlyOverwriteFile(RunnerInfo runn this.InvokeVsTest(arguments); var htmlLogFilePath = Path.Combine(Directory.GetCurrentDirectory(), "TestResults", htmlFileName); - var expectedHtmlFilePath = @"D:\Code\vstest\test\Microsoft.TestPlatform.AcceptanceTests\TestResults.html"; - Assert.IsTrue(IsFileAndContentEqual(htmlLogFilePath, expectedHtmlFilePath), "Invalid content in Html log file"); + // var expectedHtmlFilePath = @".\TestResults.html"; + IsFileAndContentEqual(htmlLogFilePath); } private bool IsValidXml(string xmlFilePath) @@ -111,7 +110,7 @@ private bool IsValidXml(string xmlFilePath) } } - private bool IsFileAndContentEqual(string filePath,string expectedFilePath) + private void IsFileAndContentEqual(string filePath) { StringBuilder sb = new StringBuilder(); using (var sr = new StreamReader(filePath)) @@ -120,18 +119,13 @@ private bool IsFileAndContentEqual(string filePath,string expectedFilePath) } string filePathContent = sb.ToString(); - StringBuilder sbExpected = new StringBuilder(); - using (var sr = new StreamReader(filePath)) + string[] divs = { "Total tests", "Passed", "Failed", "Skipped", "Run duration", "Pass percentage", "SampleUnitTestProject.UnitTest1.PassingTest" }; + + + foreach (string str in divs) { - sbExpected.Append(sr.ReadToEnd()); + StringAssert.Contains(filePathContent, str); } - - string expectedFilePathContent = sb.ToString(); - - if (expectedFilePathContent == filePathContent) - return true; - else - return false; } } } diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs index 2a14fa1af3..463ab2189c 100644 --- a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs @@ -176,7 +176,7 @@ public void TestResultHandlerShouldSetDisplayNameIfNullProperly() HtmlLogger.TestResult passTestResultActual = new HtmlLogger.TestResult(); - passTestResultActual.resultOutcome = TestOutcome.Passed; + passTestResultActual.ResultOutcome = TestOutcome.Passed; passTestResultActual.DisplayName = "abc"; Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestRunDetails.Results.First().DisplayName); @@ -190,7 +190,7 @@ public void TestResultHandlerShouldSetDisplayNameIfNullProperly() this.htmlLogger.TestResultHandler(new object(), pass1.Object); HtmlLogger.TestResult passTestResultActual1 = new HtmlLogger.TestResult(); - passTestResultActual.resultOutcome = TestOutcome.Passed; + passTestResultActual.ResultOutcome = TestOutcome.Passed; passTestResultActual.DisplayName = "def"; Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestRunDetails.Results.Last().DisplayName); @@ -242,7 +242,7 @@ public void TestResultHandlerShouldCreateOneTestEntryForEachTestCase() this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); - Assert.AreEqual(this.htmlLogger.TestRunDetails.GetTestResultscount(), 2, "TestResultHandler is not creating test result entry for each test case"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Results.Count(), 2, "TestResultHandler is not creating test result entry for each test case"); } [TestMethod] @@ -262,8 +262,8 @@ public void TestResultHandlerShouldAddHierarchicalResultsForOrderedTest() this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); - Assert.AreEqual(this.htmlLogger.TestRunDetails.GetTestResultscount(), 1, "testhandler is adding parent result correctly"); - Assert.IsNull(this.htmlLogger.TestRunDetails.Results[0].innerTestResults, "testhandler is adding child result correctly"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Results.Count(), 1, "testhandler is adding parent result correctly"); + Assert.IsNull(this.htmlLogger.TestRunDetails.Results[0].InnerTestResults, "testhandler is adding child result correctly"); ObjectModel.TestResult result2 = new ObjectModel.TestResult(testCase2); result2.SetPropertyValue(HtmlLoggerConstants.ExecutionIdProperty, Guid.NewGuid()); @@ -280,8 +280,8 @@ public void TestResultHandlerShouldAddHierarchicalResultsForOrderedTest() this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); this.htmlLogger.TestResultHandler(new object(), resultEventArg3.Object); - Assert.AreEqual(this.htmlLogger.TestRunDetails.GetTestResultscount(), 1, "testhandler is adding parent result correctly"); - Assert.AreEqual(this.htmlLogger.TestRunDetails.Results[0].GetInnerTestResultscount(), 2, "testhandler is adding child result correctly"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Results.Count(), 1, "testhandler is adding parent result correctly"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.Results[0].InnerTestResults.Count, 2, "testhandler is adding child result correctly"); } [TestMethod] @@ -332,8 +332,15 @@ public void TestCompleteHandlerShouldKeepTackOfSummary() public void TestCompleteHandlerShouldCreateFileCorrectly() { string fileName; + TestCase testCase1 = CreateTestCase("TestCase1"); + ObjectModel.TestResult result1 = new ObjectModel.TestResult(testCase1); + result1.Outcome = TestOutcome.Failed; + Mock resultEventArg1 = new Mock(result1); + + this.mockFileHelper.Setup(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite)).Callback((x, y, z) => fileName = x).Returns(new Mock().Object); + this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); this.mockFileHelper.Verify(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite), Times.Once); @@ -344,8 +351,16 @@ public void TestCompleteHandlerShouldCreateFileCorrectly() public void TestCompleteHandlerShouldCallHtmlTransformerCorrectly() { string fileName; + TestCase testCase1 = CreateTestCase("TestCase1"); + ObjectModel.TestResult result1 = new ObjectModel.TestResult(testCase1); + result1.Outcome = TestOutcome.Failed; + Mock resultEventArg1 = new Mock(result1); + this.mockFileHelper.Setup(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite)).Callback((x, y, z) => fileName = x).Returns(new Mock().Object); + + this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); + this.mockHtmlTransformer.Verify(x => x.Transform(It.IsAny(), It.IsAny()), Times.Once); } @@ -353,8 +368,13 @@ public void TestCompleteHandlerShouldCallHtmlTransformerCorrectly() public void TestCompleteHandlerShouldWriteToXmlSerializerCorrectly() { string fileName; - this.mockFileHelper.Setup(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite)).Callback((x, y, z) => fileName = x).Returns(new Mock().Object); + TestCase testCase1 = CreateTestCase("TestCase1"); + ObjectModel.TestResult result1 = new ObjectModel.TestResult(testCase1); + result1.Outcome = TestOutcome.Failed; + Mock resultEventArg1 = new Mock(result1); + this.mockFileHelper.Setup(x => x.GetStream(It.IsAny(), FileMode.Create, FileAccess.ReadWrite)).Callback((x, y, z) => fileName = x).Returns(new Mock().Object); + this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); this.htmlLogger.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero)); this.mockXmlSerializer.Verify(x => x.WriteObject(It.IsAny(), It.IsAny()), Times.Once); @@ -366,7 +386,7 @@ private HtmlLogger.TestResult CreateTestResult(TestOutcome testoutcome, string d { HtmlLogger.TestResult testResult = new HtmlLogger.TestResult(); - testResult.resultOutcome = testoutcome; + testResult.ResultOutcome = testoutcome; testResult.DisplayName = displayName; return testResult; } From df250ee4fc3be07fb21bc7b4663529efb21ebd26 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Thu, 22 Aug 2019 20:38:29 +0530 Subject: [PATCH 15/20] added failed results --- .../Html.xslt | 98 +++++++++++++------ .../HtmlLogger.cs | 67 ++++++++----- .../HtmlTransformer.cs | 1 - .../ObjectModel/TestResultCollection.cs | 30 ++++++ .../ObjectModel/TestRunDetails.cs | 8 +- .../ObjectModel/TestRunSummary.cs | 4 +- .../ObjectModel/Testresult.cs | 8 +- .../LoggerTests.cs | 5 - .../HtmlLoggerTests.cs | 90 ++++++++++------- 9 files changed, 210 insertions(+), 101 deletions(-) create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResultCollection.cs diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt index 04e44f1f53..daba087b14 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt @@ -1,6 +1,6 @@  @@ -25,7 +25,8 @@ -

Results

- +
-
- -
+
-
- -
-
- -
+
+

- - + +

Failed Results

+

All Results

+
+ + + + + +
+ +
+
- + + + + +
+ +
+
+
+ + + + -
- +
+
-
+
@@ -115,21 +147,23 @@
-
+
- +
- - +
+ + +
-     Error:
+ Error:
-     Stack trace:
+ Stack trace:
@@ -159,14 +193,14 @@ - ! +
- +   diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs index 30263255c0..f2911e67dd 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs @@ -12,7 +12,6 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger using System; using System.Collections.Concurrent; using System.Collections.Generic; - using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; @@ -20,6 +19,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger using System.Xml.Xsl; using HtmlResource = Resources.Resources; using HtmlLoggerConstants = Microsoft.TestPlatform.Extensions.HtmlLogger.Utility.Constants; + using Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel; /// /// Logger for generating Html. @@ -28,7 +28,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger [ExtensionUri(HtmlLoggerConstants.ExtensionUri)] public class Htmllogger : ITestLoggerWithParameters { - private IFileHelper filehelper; + private IFileHelper fileHelper; private XmlObjectSerializer xmlSerializer; private IHtmlTransformer htmlTransformer; private string fileName; @@ -39,9 +39,9 @@ public Htmllogger() { } - public Htmllogger(IFileHelper filehelper, IHtmlTransformer htmlTransformer, XmlObjectSerializer dataContractSerializer) + public Htmllogger(IFileHelper fileHelper, IHtmlTransformer htmlTransformer, XmlObjectSerializer dataContractSerializer) { - this.filehelper = filehelper; + this.fileHelper = fileHelper; this.htmlTransformer = htmlTransformer; this.xmlSerializer = dataContractSerializer; } @@ -55,7 +55,9 @@ public Htmllogger(IFileHelper filehelper, IHtmlTransformer htmlTransformer, XmlO /// Total results are stored in sequential order /// /// - public ConcurrentDictionary Results { get; private set; } + public ConcurrentDictionary Results { get; private set; } + + public ConcurrentDictionary ResultCollectionDictionary { get; private set; } /// /// Test results stores all the summary and the details of evrey results in hiearachial order. @@ -103,7 +105,8 @@ public void Initialize(TestLoggerEvents events, string TestResultsDirPath) this.TestResultsDirPath = TestResultsDirPath; this.TestRunDetails = new TestRunDetails(); - this.Results = new ConcurrentDictionary(); + this.Results = new ConcurrentDictionary(); + this.ResultCollectionDictionary = new ConcurrentDictionary(); } /// @@ -163,22 +166,37 @@ internal void TestResultHandler(object sender, TestResultEventArgs e) ValidateArg.NotNull(sender, "sender"); ValidateArg.NotNull(e, "e"); - TestResult testResult = new TestResult(); - testResult.DisplayName = e.Result.DisplayName ?? e.Result.TestCase.DisplayName; + ObjectModel.TestResult testResult = new ObjectModel.TestResult(); + testResult.DisplayName = e.Result.DisplayName ?? e.Result.TestCase.FullyQualifiedName; testResult.FullyQualifiedName = e.Result.TestCase.FullyQualifiedName; testResult.Duration = GetFormattedDurationString(e.Result.Duration); testResult.ErrorStackTrace = e.Result.ErrorStackTrace; testResult.ErrorMessage = e.Result.ErrorMessage; + testResult.TestResultId = e.Result.TestCase.Id; + testResult.ResultOutcome = e.Result.Outcome; var executionId = this.GetExecutionId(e.Result); var parentExecutionId = this.GetParentExecutionId(e.Result); + ResultCollectionDictionary.TryGetValue(e.Result.TestCase.Source, out TestResultCollection testResultCollection); + if (testResultCollection == null) + { + testResultCollection = new TestResultCollection + { + Source = e.Result.TestCase.Source, + ResultList = new List(), + FailedResultList = new List(), + }; + ResultCollectionDictionary.TryAdd(e.Result.TestCase.Source, testResultCollection); + TestRunDetails.ResultCollectionList.Add(testResultCollection); + } + testResultCollection.Id= testResultCollection.Source.GetHashCode(); + this.TotalTests++; - testResult.ResultOutcome = e.Result.Outcome; if (e.Result.Outcome == TestOutcome.Failed) { - this.FailedTests++; + this.FailedTests++; } else if (e.Result.Outcome == TestOutcome.Passed) { @@ -191,7 +209,12 @@ internal void TestResultHandler(object sender, TestResultEventArgs e) if (parentExecutionId == Guid.Empty) { - TestRunDetails.Results.Add(testResult); + if (e.Result.Outcome == TestOutcome.Failed) + { + testResultCollection.FailedResultList.Add(testResult); + } + + testResultCollection.ResultList.Add(testResult); } Results.TryAdd(executionId, testResult); @@ -201,13 +224,13 @@ internal void TestResultHandler(object sender, TestResultEventArgs e) } } - private void AddToParentResult( Guid parentExecutionId, TestResult testResult) + private void AddToParentResult( Guid parentExecutionId, ObjectModel.TestResult testResult) { - TestResult parentTestResult; + ObjectModel.TestResult parentTestResult; this.Results.TryGetValue(parentExecutionId, out parentTestResult); if (parentTestResult.InnerTestResults == null) - parentTestResult.InnerTestResults = new List(); + parentTestResult.InnerTestResults = new List(); parentTestResult.InnerTestResults.Add(testResult); } @@ -248,7 +271,7 @@ private void PopulateHtmlFile() try { - using (Stream xmlStream = this.filehelper.GetStream(XmlFilePath, FileMode.Create)) + using (Stream xmlStream = this.fileHelper.GetStream(XmlFilePath, FileMode.Create)) { xmlSerializer.WriteObject(xmlStream, TestRunDetails); } @@ -270,15 +293,15 @@ private void PopulateHtmlFile() return; } - string htmlfilePathMessage = string.Format(CultureInfo.CurrentCulture, HtmlResource.HtmlFilePath, HtmlFilePath); - EqtTrace.Info(htmlfilePathMessage); - ConsoleOutput.Instance.Information(false, htmlfilePathMessage); + string htmlFilePathMessage = string.Format(CultureInfo.CurrentCulture, HtmlResource.HtmlFilePath, HtmlFilePath); + EqtTrace.Info(htmlFilePathMessage); + ConsoleOutput.Instance.Information(false, htmlFilePathMessage); } private string GetFilePath(string fileFormat,string FileName) { - var fullfileformat = string.Concat("." + fileFormat); - return Path.Combine(this.TestResultsDirPath, string.Concat("TestResult_", FileName, fullfileformat)); + var fullFileFormat = string.Concat("." + fileFormat); + return Path.Combine(this.TestResultsDirPath, string.Concat("TestResult_", FileName, fullFileFormat)); } private static string FormatDateTimeForRunName(DateTime timeStamp) @@ -291,7 +314,7 @@ private static string FormatDateTimeForRunName(DateTime timeStamp) /// /// /// - private Guid GetParentExecutionId(ObjectModel.TestResult testResult) + private Guid GetParentExecutionId(TestPlatform.ObjectModel.TestResult testResult) { TestProperty parentExecutionIdProperty = testResult.Properties.FirstOrDefault(property => property.Id.Equals(HtmlLoggerConstants.ParentExecutionIdPropertyIdentifier)); return parentExecutionIdProperty == null ? Guid.Empty : testResult.GetPropertyValue(parentExecutionIdProperty, Guid.Empty); @@ -302,7 +325,7 @@ private Guid GetParentExecutionId(ObjectModel.TestResult testResult) /// /// /// - private Guid GetExecutionId(ObjectModel.TestResult testResult) + private Guid GetExecutionId(TestPlatform.ObjectModel.TestResult testResult) { TestProperty executionIdProperty = testResult.Properties.FirstOrDefault(property => property.Id.Equals(HtmlLoggerConstants.ExecutionIdPropertyIdentifier)); var executionId = Guid.Empty; diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs index dbba6abe80..e4eb374dbd 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs @@ -5,7 +5,6 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger { using System.Xml; using System.Xml.Xsl; - using HtmlResources = Resources.Resources; class HtmlTransformer : IHtmlTransformer { diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResultCollection.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResultCollection.cs new file mode 100644 index 0000000000..56f0559c84 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestResultCollection.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel +{ + using System.Collections.Generic; + + public class TestResultCollection + { + /// + /// Source of the test dll. + /// + public string Source { get; set; } + + /// + /// Hash id of source. + /// + public int Id { get; set; } + + /// + /// List of test results. + /// + public List ResultList { get; set; } + + /// + /// list of failed test results. + /// + public List FailedResultList { get; set; } + } +} diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs index b639795a0b..14a5809c5b 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunDetails.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel { + using System.Collections.Concurrent; using System.Collections.Generic; using System.Runtime.Serialization; [DataContract] - [KnownType(typeof(TestResult))] public sealed class TestRunDetails { /// @@ -30,7 +30,7 @@ public TestRunDetails() internal List RunLevelMessageInformational = new List(); /// - /// List of error and warning messages + /// List of error and warning messages. /// [DataMember] internal List RunLevelMessageErrorAndWarning = new List(); @@ -39,6 +39,6 @@ public TestRunDetails() /// List of all the results /// [DataMember] - internal List Results = new List(); + internal List ResultCollectionList = new List(); } } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs index b10df8d273..4b30d25232 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/TestRunSummary.cs @@ -1,9 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.Runtime.Serialization; - -namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel { public class TestRunSummary { diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs index b0de51fcc6..88bc22f2b3 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/ObjectModel/Testresult.cs @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel { using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using System; using System.Collections.Generic; public class TestResult @@ -14,6 +15,11 @@ public class TestResult /// public string FullyQualifiedName { get; set; } + /// + /// Unique identifier for test result + /// + public Guid TestResultId { get; set; } + /// /// Display Name for the particular Test Result /// diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs index 60fd2fce25..9c86723df4 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; using System.IO; using System.Xml; @@ -90,7 +89,6 @@ public void HtmlLoggerWithExecutorUriShouldProperlyOverwriteFile(RunnerInfo runn this.InvokeVsTest(arguments); var htmlLogFilePath = Path.Combine(Directory.GetCurrentDirectory(), "TestResults", htmlFileName); - // var expectedHtmlFilePath = @".\TestResults.html"; IsFileAndContentEqual(htmlLogFilePath); } @@ -118,10 +116,7 @@ private void IsFileAndContentEqual(string filePath) sb.Append(sr.ReadToEnd()); } string filePathContent = sb.ToString(); - string[] divs = { "Total tests", "Passed", "Failed", "Skipped", "Run duration", "Pass percentage", "SampleUnitTestProject.UnitTest1.PassingTest" }; - - foreach (string str in divs) { StringAssert.Contains(filePathContent, str); diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs index 463ab2189c..d2385f1049 100644 --- a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs @@ -19,6 +19,7 @@ namespace Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests using System.Linq; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; using System.Runtime.Serialization; + using Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel; [TestClass] public class HtmlLoggerTests @@ -168,42 +169,42 @@ public void TestResultHandlerShouldSetDisplayNameIfNullProperly() TestCase passTestCase1 = CreateTestCase("Pass1"); ObjectModel.TestResult PassTestResultExpected = new ObjectModel.TestResult(passTestCase1); PassTestResultExpected.DisplayName = null; - PassTestResultExpected.TestCase.DisplayName = "abc"; + PassTestResultExpected.TestCase.FullyQualifiedName = "abc"; Mock pass1 = new Mock(PassTestResultExpected); this.htmlLogger.TestResultHandler(new object(), pass1.Object); - HtmlLogger.TestResult passTestResultActual = new HtmlLogger.TestResult(); - + HtmlLogger.ObjectModel.TestResult passTestResultActual = new HtmlLogger.ObjectModel.TestResult(); + passTestResultActual.ResultOutcome = TestOutcome.Passed; passTestResultActual.DisplayName = "abc"; - Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestRunDetails.Results.First().DisplayName); + Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestRunDetails.ResultCollectionList.First().ResultList.First().DisplayName); TestCase passTestCase2 = CreateTestCase("Pass1"); ObjectModel.TestResult PassTestResultExpected1 = new ObjectModel.TestResult(passTestCase1); PassTestResultExpected.DisplayName = "def"; - PassTestResultExpected.TestCase.DisplayName = "abc"; + PassTestResultExpected.TestCase.FullyQualifiedName = "abc"; Mock pass2= new Mock(PassTestResultExpected); this.htmlLogger.TestResultHandler(new object(), pass1.Object); - HtmlLogger.TestResult passTestResultActual1 = new HtmlLogger.TestResult(); passTestResultActual.ResultOutcome = TestOutcome.Passed; passTestResultActual.DisplayName = "def"; - Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestRunDetails.Results.Last().DisplayName); + Assert.AreEqual(passTestResultActual.DisplayName, this.htmlLogger.TestRunDetails.ResultCollectionList.First().ResultList.Last().DisplayName); } [TestMethod] public void TestResultHandlerShouldCreateTestResultProperly() { - TestCase passTestCase2 = CreateTestCase("Pass1"); - passTestCase2.DisplayName = "abc"; - passTestCase2.FullyQualifiedName = "fully"; + TestCase passTestCase = CreateTestCase("Pass1"); + passTestCase.DisplayName = "abc"; + passTestCase.FullyQualifiedName = "fully"; + passTestCase.Source = "abc/def.dll"; - ObjectModel.TestResult PassTestResultExpected1 = new ObjectModel.TestResult(passTestCase2) + ObjectModel.TestResult PassTestResultExpected = new ObjectModel.TestResult(passTestCase) { DisplayName = "def", ErrorMessage = "error message", @@ -211,16 +212,17 @@ public void TestResultHandlerShouldCreateTestResultProperly() Duration = TimeSpan.Zero }; - Mock eventArg = new Mock(PassTestResultExpected1); + Mock eventArg = new Mock(PassTestResultExpected); this.htmlLogger.TestResultHandler(new object(), eventArg.Object); - var result = this.htmlLogger.TestRunDetails.Results.First(); + var result = this.htmlLogger.TestRunDetails.ResultCollectionList.First().ResultList.First(); Assert.AreEqual(result.DisplayName, "def"); Assert.AreEqual(result.ErrorMessage, "error message"); Assert.AreEqual(result.ErrorStackTrace, "Error strack trace"); Assert.AreEqual(result.FullyQualifiedName, "fully"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.ResultCollectionList.First().Source, "abc/def.dll"); Assert.AreEqual(result.Duration, null); } @@ -242,7 +244,44 @@ public void TestResultHandlerShouldCreateOneTestEntryForEachTestCase() this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); - Assert.AreEqual(this.htmlLogger.TestRunDetails.Results.Count(), 2, "TestResultHandler is not creating test result entry for each test case"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.ResultCollectionList.First().ResultList.Count(), 2, "TestResultHandler is not creating test result entry for each test case"); + } + + [TestMethod] + public void TestResultHandlerShouldCreateOneTestResultCollectionForOneSource() + { + TestCase testCase1 = CreateTestCase("TestCase1"); + TestCase testCase2 = CreateTestCase("TestCase2"); + testCase1.Source = "abc.dll"; + testCase2.Source = "def.dll"; + + ObjectModel.TestResult result1 = new ObjectModel.TestResult(testCase1); + result1.Outcome = TestOutcome.Failed; + + ObjectModel.TestResult result2 = new ObjectModel.TestResult(testCase2); + result2.Outcome = TestOutcome.Passed; + + Mock resultEventArg1 = new Mock(result1); + Mock resultEventArg2 = new Mock(result2); + + this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); + this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); + + Assert.AreEqual(this.htmlLogger.TestRunDetails.ResultCollectionList.Count(), 2); + } + + [TestMethod] + public void TestResultHandlerShouldAddFailedResultToFailedResultListInTestResultCollection() + { + TestCase testCase1 = CreateTestCase("TestCase1"); + ObjectModel.TestResult result1 = new ObjectModel.TestResult(testCase1); + result1.Outcome = TestOutcome.Failed; + + Mock resultEventArg1 = new Mock(result1); + + this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); + + Assert.AreEqual(this.htmlLogger.TestRunDetails.ResultCollectionList.First().FailedResultList.Count(),1); } [TestMethod] @@ -262,8 +301,8 @@ public void TestResultHandlerShouldAddHierarchicalResultsForOrderedTest() this.htmlLogger.TestResultHandler(new object(), resultEventArg1.Object); - Assert.AreEqual(this.htmlLogger.TestRunDetails.Results.Count(), 1, "testhandler is adding parent result correctly"); - Assert.IsNull(this.htmlLogger.TestRunDetails.Results[0].InnerTestResults, "testhandler is adding child result correctly"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.ResultCollectionList.First().ResultList.Count(), 1, "testhandler is adding parent result correctly"); + Assert.IsNull(this.htmlLogger.TestRunDetails.ResultCollectionList.First().ResultList.First().InnerTestResults, "testhandler is adding child result correctly"); ObjectModel.TestResult result2 = new ObjectModel.TestResult(testCase2); result2.SetPropertyValue(HtmlLoggerConstants.ExecutionIdProperty, Guid.NewGuid()); @@ -280,8 +319,8 @@ public void TestResultHandlerShouldAddHierarchicalResultsForOrderedTest() this.htmlLogger.TestResultHandler(new object(), resultEventArg2.Object); this.htmlLogger.TestResultHandler(new object(), resultEventArg3.Object); - Assert.AreEqual(this.htmlLogger.TestRunDetails.Results.Count(), 1, "testhandler is adding parent result correctly"); - Assert.AreEqual(this.htmlLogger.TestRunDetails.Results[0].InnerTestResults.Count, 2, "testhandler is adding child result correctly"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.ResultCollectionList.First().ResultList.Count(), 1, "testhandler is adding parent result correctly"); + Assert.AreEqual(this.htmlLogger.TestRunDetails.ResultCollectionList.First().ResultList.First().InnerTestResults.Count(), 2, "testhandler is adding child result correctly"); } [TestMethod] @@ -382,21 +421,6 @@ public void TestCompleteHandlerShouldWriteToXmlSerializerCorrectly() Assert.IsTrue(htmlLogger.HtmlFilePath.Contains(".html")); } - private HtmlLogger.TestResult CreateTestResult(TestOutcome testoutcome, string displayName) - { - - HtmlLogger.TestResult testResult = new HtmlLogger.TestResult(); - testResult.ResultOutcome = testoutcome; - testResult.DisplayName = displayName; - return testResult; - } - - private TestRunDetails CreateTestResults() - { - TestRunDetails testresults = new TestRunDetails(); - return testresults; - } - private static TestCase CreateTestCase(string testCaseName) { return new TestCase(testCaseName, new Uri("some://uri"), "DummySourceFileName"); From 6b81048a004ba5f307757a76218b836ce6f02e73 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Fri, 23 Aug 2019 20:42:44 +0530 Subject: [PATCH 16/20] code refactoring using resharper --- .../Constants.cs | 62 ++++ .../Html.xslt | 2 +- .../HtmlLogger.cs | 247 ++++++++-------- .../HtmlTransformer.cs | 19 +- .../IHtmlTransformer.cs | 8 +- .../ObjectModel/TestResultCollection.cs | 15 +- .../ObjectModel/TestRunDetails.cs | 22 +- .../ObjectModel/TestRunSummary.cs | 3 + .../ObjectModel/Testresult.cs | 5 +- .../Resources/Resources.Designer.cs | 9 + .../Resources/Resources.resx | 3 + .../HtmlLoggerTests.cs | 270 ++++++++---------- 12 files changed, 363 insertions(+), 302 deletions(-) create mode 100644 src/Microsoft.TestPlatform.Extensions.HtmlLogger/Constants.cs diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Constants.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Constants.cs new file mode 100644 index 0000000000..fb91883432 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Constants.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger +{ + using System; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + + public static class Constants + { + /// + /// Uri used to uniquely identify the Html logger. + /// + public const string ExtensionUri = "logger://Microsoft/TestPlatform/HtmlLogger/v1"; + + /// + /// Alternate user friendly string to uniquely identify the console logger. + /// + public const string FriendlyName = "Html"; + + /// + /// The file extension of xml file + /// + public const string XmlFileExtension = "xml"; + + /// + /// The file extension of html file + /// + public const string HtmlFileExtension = "html"; + + /// /// + /// Property Id storing the TestType. + /// + public const string TestTypePropertyIdentifier = "TestType"; + + /// + /// Ordered test type guid + /// + public static readonly Guid OrderedTestTypeGuid = new Guid("ec4800e8-40e5-4ab3-8510-b8bf29b1904d"); + + /// + /// Property Id storing the ParentExecutionId. + /// + public const string ParentExecutionIdPropertyIdentifier = "ParentExecId"; + + /// + /// Property Id storing the ExecutionId. + /// + public const string ExecutionIdPropertyIdentifier = "ExecutionId"; + + /// + /// Log file parameter key + /// + public const string LogFileNameKey = "LogFileName"; + + public static readonly TestProperty ExecutionIdProperty = TestProperty.Register("ExecutionId", ExecutionIdPropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(TestResult)); + + public static readonly TestProperty ParentExecIdProperty = TestProperty.Register("ParentExecId", ParentExecutionIdPropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(TestResult)); + + public static readonly TestProperty TestTypeProperty = TestProperty.Register("TestType", TestTypePropertyIdentifier, typeof(Guid), TestPropertyAttributes.Hidden, typeof(TestResult)); + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt index daba087b14..8aa913fde4 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt @@ -121,7 +121,7 @@
-