Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
348fe08
First draft for the Html Logger.
Jul 29, 2019
56091eb
Adding the Program.cs for making the unit tests project build
Jul 29, 2019
a5fe993
1. Added docs for methods
Jul 30, 2019
0ed9a7e
Html logger acceptance Test added
Aug 8, 2019
385edf5
Merge remote-tracking branch 'upstream/master' into HtmlLogger
Aug 8, 2019
29aed06
incresed the file count in Tesplatform.portable and Testplatform nusp…
Aug 9, 2019
49ee322
Adding xlf files
Aug 9, 2019
e34d3df
Added installing dotnet-cli in build
Aug 9, 2019
203a717
Corrected defaultParamter:Logfile on HtmlLoggerTests
Aug 9, 2019
62011ee
Changed the hardcoded folder name of testresults
Aug 9, 2019
ff3d43d
Html.xslt is added to dll
Aug 12, 2019
ed1fdc9
Changed the file name html.xslt to Html.xslt and Added styling in xslt
Aug 13, 2019
b29505c
TestResults changed to TestRunDetails and summary comments corrected
Aug 13, 2019
35fcc2a
Added clickability and added test run duration and passing percentage
Aug 14, 2019
7fdf5e4
redundant code in xslt is removed and acceptanece test is corrected
Aug 19, 2019
df250ee
added failed results
Aug 22, 2019
6b81048
code refactoring using resharper
Aug 23, 2019
fef0cae
Merge branch 'master' into HtmlLogger
hvinett Aug 26, 2019
4b0a936
Fixed the xslt issues and added comments.\
Aug 26, 2019
b5e26c8
Merge from master
Aug 26, 2019
c48eca1
Merge branch 'HtmlLogger' of https://github.com/hvinett/vstest into H…
Aug 26, 2019
93467b2
unit tests refactored
Aug 27, 2019
35067d6
friend.cs added
Aug 27, 2019
14e82ee
Days in GetFormattedDurationString is fixed
Aug 28, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions TestPlatform.sln
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -172,6 +175,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
Expand Down Expand Up @@ -866,6 +873,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
Expand Down Expand Up @@ -940,6 +971,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}
Expand Down
4 changes: 3 additions & 1 deletion scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions scripts/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
10 changes: 10 additions & 0 deletions src/Microsoft.TestPlatform.Extensions.HtmlLogger/Friends.cs
Original file line number Diff line number Diff line change
@@ -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
212 changes: 212 additions & 0 deletions src/Microsoft.TestPlatform.Extensions.HtmlLogger/Html.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
<?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>
Loading