Skip to content

Commit 0c0f134

Browse files
authored
Merge pull request #371 from tonyhallett/open-cobertura
Open cobertura and hotspot files
2 parents 28fda4b + 7afd3f4 commit 0c0f134

30 files changed

+812
-113
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ x64/
2020
# NCrunch
2121
*.ncrunchsolution
2222
*.ncrunchproject
23-
_NCrunch_WebCompiler
23+
_NCrunch_WebCompiler
24+
/MSBuild_Logs

FineCodeCoverage.sln

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30114.105
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34408.163
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FineCodeCoverage", "FineCodeCoverage\FineCodeCoverage.csproj", "{31C104BB-D294-4942-B206-896AA7A5FCB9}"
77
EndProject
@@ -27,12 +27,12 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedProject", "SharedProj
2727
EndProject
2828
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FineCodeCoverage2022", "FineCodeCoverage2022\FineCodeCoverage2022.csproj", "{59A22196-A750-4BA4-B30E-BE1422E68B8E}"
2929
EndProject
30+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BAA6EBA8-65A6-46B0-8719-CB5C7EE6AE96}"
31+
ProjectSection(SolutionItems) = preProject
32+
.github\FUNDING.yml = .github\FUNDING.yml
33+
EndProjectSection
34+
EndProject
3035
Global
31-
GlobalSection(SharedMSBuildProjectFiles) = preSolution
32-
SharedProject\SharedProject.projitems*{31c104bb-d294-4942-b206-896aa7a5fcb9}*SharedItemsImports = 4
33-
SharedProject\SharedProject.projitems*{59a22196-a750-4ba4-b30e-be1422e68b8e}*SharedItemsImports = 4
34-
SharedProject\SharedProject.projitems*{9353044c-5d39-4e70-8e78-28213e05217a}*SharedItemsImports = 13
35-
EndGlobalSection
3636
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3737
Debug|Any CPU = Debug|Any CPU
3838
Release|Any CPU = Release|Any CPU
@@ -61,4 +61,9 @@ Global
6161
GlobalSection(ExtensibilityGlobals) = postSolution
6262
SolutionGuid = {EE8856CF-D8F1-4ECF-A722-F677A6F107A3}
6363
EndGlobalSection
64+
GlobalSection(SharedMSBuildProjectFiles) = preSolution
65+
SharedProject\SharedProject.projitems*{31c104bb-d294-4942-b206-896aa7a5fcb9}*SharedItemsImports = 4
66+
SharedProject\SharedProject.projitems*{59a22196-a750-4ba4-b30e-be1422e68b8e}*SharedItemsImports = 4
67+
SharedProject\SharedProject.projitems*{9353044c-5d39-4e70-8e78-28213e05217a}*SharedItemsImports = 13
68+
EndGlobalSection
6469
EndGlobal

FineCodeCoverage/FineCodeCoverage.csproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
<WarningLevel>4</WarningLevel>
5454
</PropertyGroup>
5555
<ItemGroup>
56+
<Compile Include="..\Shared Files\OutputToolWindowPackage.cs">
57+
<Link>OutputToolWindowPackage.cs</Link>
58+
<AutoGen>True</AutoGen>
59+
<DesignTime>True</DesignTime>
60+
<DependentUpon>OutputToolWindowPackage.vsct</DependentUpon>
61+
</Compile>
5662
<Compile Include="Properties\AssemblyInfo.cs" />
5763
<Compile Include="source.extension.cs">
5864
<AutoGen>True</AutoGen>
@@ -84,6 +90,8 @@
8490
<VSCTCompile Include="..\Shared Files\OutputToolWindowPackage.vsct">
8591
<Link>OutputToolWindowPackage.vsct</Link>
8692
<ResourceName>Menus.ctmenu</ResourceName>
93+
<Generator>VsctGenerator</Generator>
94+
<LastGenOutput>OutputToolWindowPackage.cs</LastGenOutput>
8795
</VSCTCompile>
8896
<Content Include="..\Shared Files\Resources\ClearUICommand.png">
8997
<Link>Resources\ClearUICommand.png</Link>
@@ -130,6 +138,9 @@
130138
<PackageReference Include="CliWrap">
131139
<Version>3.2.2</Version>
132140
</PackageReference>
141+
<PackageReference Include="Esprima">
142+
<Version>3.0.1</Version>
143+
</PackageReference>
133144
<PackageReference Include="EventAggregator.Net">
134145
<Version>1.2.0</Version>
135146
</PackageReference>
@@ -165,7 +176,7 @@
165176
<Version>3.3.0</Version>
166177
</PackageReference>
167178
<PackageReference Include="System.Composition">
168-
<Version>5.0.1</Version>
179+
<Version>7.0.0</Version>
169180
</PackageReference>
170181
<PackageReference Include="System.IO.Compression">
171182
<Version>4.3.0</Version>

FineCodeCoverage2022/FineCodeCoverage2022.csproj

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<ProjectGuid>{59A22196-A750-4BA4-B30E-BE1422E68B8E}</ProjectGuid>
1414
<OutputType>Library</OutputType>
1515
<AppDesignerFolder>Properties</AppDesignerFolder>
16-
<RootNamespace>FineCodeCoverage2022</RootNamespace>
16+
<RootNamespace>FineCodeCoverage</RootNamespace>
1717
<AssemblyName>FineCodeCoverage2022</AssemblyName>
1818
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1919
<GeneratePkgDefFile>true</GeneratePkgDefFile>
@@ -45,6 +45,12 @@
4545
<WarningLevel>4</WarningLevel>
4646
</PropertyGroup>
4747
<ItemGroup>
48+
<Compile Include="..\Shared Files\OutputToolWindowPackage.cs">
49+
<Link>OutputToolWindowPackage.cs</Link>
50+
<AutoGen>True</AutoGen>
51+
<DesignTime>True</DesignTime>
52+
<DependentUpon>OutputToolWindowPackage.vsct</DependentUpon>
53+
</Compile>
4854
<Compile Include="Properties\AssemblyInfo.cs" />
4955
<Compile Include="source.extension.cs">
5056
<AutoGen>True</AutoGen>
@@ -60,6 +66,8 @@
6066
<VSCTCompile Include="..\Shared Files\OutputToolWindowPackage.vsct">
6167
<Link>OutputToolWindowPackage.vsct</Link>
6268
<ResourceName>Menus.ctmenu</ResourceName>
69+
<Generator>VsctGenerator</Generator>
70+
<LastGenOutput>OutputToolWindowPackage.cs</LastGenOutput>
6371
</VSCTCompile>
6472
<Content Include="..\Art\preview-coverage.png">
6573
<Link>Resources\preview-coverage.png</Link>
@@ -103,6 +111,8 @@
103111
</Content>
104112
<None Include="source.extension.vsixmanifest">
105113
<SubType>Designer</SubType>
114+
<Generator>VsixManifestGenerator</Generator>
115+
<LastGenOutput>source.extension.cs</LastGenOutput>
106116
</None>
107117
</ItemGroup>
108118
<ItemGroup>
@@ -123,6 +133,9 @@
123133
<PackageReference Include="CliWrap">
124134
<Version>3.2.2</Version>
125135
</PackageReference>
136+
<PackageReference Include="Esprima">
137+
<Version>3.0.1</Version>
138+
</PackageReference>
126139
<PackageReference Include="EventAggregator.Net">
127140
<Version>1.2.0</Version>
128141
</PackageReference>
@@ -158,7 +171,7 @@
158171
<Version>3.3.0</Version>
159172
</PackageReference>
160173
<PackageReference Include="System.Composition">
161-
<Version>5.0.1</Version>
174+
<Version>7.0.0</Version>
162175
</PackageReference>
163176
<PackageReference Include="System.IO.Compression">
164177
<Version>4.3.0</Version>

FineCodeCoverage2022/source.extension.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ namespace FineCodeCoverage
77
{
88
internal sealed partial class Vsix
99
{
10-
public const string Id = "fcc-f339fe606-9d51-4fca-895c-d50375137b62";
10+
public const string Id = "FineCodeCoverage2022.ad53fb28-7a11-4465-a27a-3550499ea4a1";
1111
public const string Name = "Fine Code Coverage";
1212
public const string Description = @"Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)";
1313
public const string Language = "en-US";
14-
public const string Version = "1.0.0";
14+
public const string Version = "1.1.0";
1515
public const string Author = "Fortune Ngwenya";
16-
public const string Tags = "visual studio, code coverage, c#, vb, .net core, coverlet, unit test, free, community edition";
16+
public const string Tags = "visual studio; code coverage; c#; vb; .net core; coverlet; unit test; free; community edition";
1717
}
1818
}

FineCodeCoverageTests/AppOptionsProvider_Tests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ public void Should_Not_Default_Any_Other_AppOptions_Properties()
196196
nameof(IAppOptions.ShowCoverageInOverviewMargin),
197197
nameof(IAppOptions.ShowCoveredInOverviewMargin),
198198
nameof(IAppOptions.ShowUncoveredInOverviewMargin),
199-
nameof(IAppOptions.ShowPartiallyCoveredInOverviewMargin)
199+
nameof(IAppOptions.ShowPartiallyCoveredInOverviewMargin),
200+
nameof(IAppOptions.ShowToolWindowToolbar)
200201
};
201202
CollectionAssert.AreEquivalent(expectedSetters.Select(s => $"set_{s}"), invocationNames);
202203
}
@@ -302,6 +303,7 @@ internal void Should_Use_Deseralized_String_From_Store_For_AppOption_Property(Fu
302303
{ nameof(IAppOptions.ShowCoveredInOverviewMargin),true},
303304
{ nameof(IAppOptions.ShowPartiallyCoveredInOverviewMargin),true},
304305
{ nameof(IAppOptions.ShowUncoveredInOverviewMargin),true},
306+
{ nameof(IAppOptions.ShowToolWindowToolbar),true},
305307
};
306308
var mockJsonConvertService = autoMocker.GetMock<IJsonConvertService>();
307309
mockJsonConvertService.Setup(

FineCodeCoverageTests/CoverageToolOutput_Tests/CoverageToolOutputManager_Tests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using FineCodeCoverage.Engine.Model;
88
using Moq;
99
using NUnit.Framework;
10+
using SharedProject.Core.CoverageToolOutput;
1011

1112
namespace FineCodeCoverageTests
1213
{
@@ -93,6 +94,15 @@ public void Should_Log_When_Provided()
9394
mocker.Verify<ILogger>(l => l.Log("FCC output in Provided"));
9495
}
9596

97+
[Test]
98+
public void Should_Raise_The_OutdatedOutputMessge()
99+
{
100+
SetUpProviders(true, "Provided", "_");
101+
var coverageToolOutputManager = mocker.Create<CoverageToolOutputManager>();
102+
coverageToolOutputManager.SetProjectCoverageOutputFolder(coverageProjects);
103+
mocker.Verify<IEventAggregator>(eventAggregator => eventAggregator.SendMessage(It.IsAny<OutdatedOutputMessage>(), null));
104+
}
105+
96106
[Test]
97107
public void Should_Set_CoverageOutputFolder_To_ProjectName_Sub_Folder_Of_Provided()
98108
{

FineCodeCoverageTests/FCCEngine_Tests.cs

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using FineCodeCoverage.Engine.ReportGenerator;
1414
using FineCodeCoverage.Impl;
1515
using FineCodeCoverage.Options;
16+
using FineCodeCoverage.Output;
1617
using Moq;
1718
using NUnit.Framework;
1819

@@ -254,30 +255,51 @@ public async Task Should_Not_Run_ReportGenerator_If_No_Successful_Projects()
254255
}
255256

256257
[Test]
257-
public async Task Should_Process_ReportGenerator_Output_If_Success()
258+
public async Task Should_Process_ReportGenerator_Output_If_Success_Raising_Events()
258259
{
259260
var passedProject = CreateSuitableProject();
260-
261+
var reportGeneratorResult = new ReportGeneratorResult
262+
{
263+
UnifiedXmlFile = "Unified xml file",
264+
UnifiedHtml = "Unified html",
265+
HotspotsFile = "Hotspots file path",
266+
267+
};
261268
var mockReportGenerator = mocker.GetMock<IReportGeneratorUtil>();
262269
mockReportGenerator.Setup(rg =>
263270
rg.GenerateAsync(
264271
It.IsAny<IEnumerable<string>>(),
265272
It.IsAny<string>(),
266273
It.IsAny<CancellationToken>()
267274
).Result)
268-
.Returns(
269-
new ReportGeneratorResult
270-
{
271-
UnifiedXmlFile = "Unified xml file",
272-
UnifiedHtml = "Unified html"
273-
}
274-
);
275+
.Returns(reportGeneratorResult);
276+
277+
mockReportGenerator.Setup(rg => rg.ProcessUnifiedHtml("Unified html", It.IsAny<string>())).Returns("processed");
275278

276-
mockReportGenerator.Setup(rg => rg.ProcessUnifiedHtml("Unified html", It.IsAny<string>()));
279+
var mockCoberturaUtil = mocker.GetMock<ICoberturaUtil>();
280+
var fileLineCoverage = new FileLineCoverage();
281+
mockCoberturaUtil.Setup(coberturaUtil => coberturaUtil.ProcessCoberturaXml("Unified xml file")).Returns(fileLineCoverage);
277282

278283
await ReloadInitializedCoverage(passedProject.Object);
279-
mocker.Verify<ICoberturaUtil>(coberturaUtil => coberturaUtil.ProcessCoberturaXml("Unified xml file"));
284+
280285
mockReportGenerator.VerifyAll();
286+
mockReportGenerator.Verify(reportGenerator => reportGenerator.EndOfCoverageRun());
287+
288+
mocker.Verify<IEventAggregator>(eventAggregator => eventAggregator.SendMessage(
289+
It.Is<NewCoverageLinesMessage>(message => message.CoverageLines == fileLineCoverage),
290+
null
291+
));
292+
293+
mocker.Verify<IEventAggregator>(eventAggregator => eventAggregator.SendMessage(
294+
It.Is<NewReportMessage>(message => message.Report == "processed"),
295+
null
296+
));
297+
298+
mocker.Verify<IEventAggregator>(eventAggregator => eventAggregator.SendMessage(
299+
It.Is<ReportFilesMessage>(message => message.CoberturaFile == reportGeneratorResult.UnifiedXmlFile && message.HotspotsFile == reportGeneratorResult.HotspotsFile),
300+
null
301+
));
302+
281303
}
282304

283305
[Test]

FineCodeCoverageTests/MsCodeCoverage/RunSettingsTemplateReplacementsFactory_Tests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,5 +691,6 @@ internal class TestCoverageProjectOptions : IAppOptions
691691
public bool ShowCoveredInOverviewMargin { get; set; }
692692
public bool ShowUncoveredInOverviewMargin { get; set; }
693693
public bool ShowPartiallyCoveredInOverviewMargin { get; set; }
694+
public bool ShowToolWindowToolbar { get; set; }
694695
}
695696
}

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ ShowCoveredInOverviewMargin Set to false to prevent covered marks in th
237237
ShowUncoveredInOverviewMargin Set to false to prevent uncovered marks in the overview margin
238238
ShowPartiallyCoveredInOverviewMargin Set to false to prevent partially covered marks in the overview margin
239239
240+
ShowToolWindowToolbar Set to false to hide the toolbar on the tool window. Requires restarting Visual Studio. The toolbar has buttons for viewing
241+
the Cobertura xml and the risk hotspots.
242+
240243
FCCSolutionOutputDirectoryName To have fcc output visible in a sub folder of your solution provide this name
241244
242245
ToolsDirectory Folder to which copy tools subfolder. Must alredy exist. Requires restart of VS.
@@ -329,7 +332,7 @@ Check out the [contribution guidelines](CONTRIBUTING.md)
329332
if you want to contribute to this project.
330333

331334
For cloning and building this project yourself, make sure
332-
to install the [Extensibility Tools 2015](https://visualstudiogallery.msdn.microsoft.com/ab39a092-1343-46e2-b0f1-6a3f91155aa6)
335+
to install the [Extensibility Essentials](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ExtensibilityEssentials2022)
333336
extension for Visual Studio which enables some features
334337
used by this project.
335338

0 commit comments

Comments
 (0)