Skip to content

Commit

Permalink
Merge pull request #5 from VirtualPhotonics/feature/increase_unit_tes…
Browse files Browse the repository at this point in the history
…t_coverage

Feature/increase unit test coverage
  • Loading branch information
Lisa Malenfant authored Jul 27, 2023
2 parents 74a2d75 + a5d011e commit a75c025
Show file tree
Hide file tree
Showing 40 changed files with 3,028 additions and 198 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"VirtualPhotonics_Vts.MonteCarlo" /o:"virtualphotonics" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.nunit.reportsPaths=TestResults/*.trx
.\.sonar\scanner\dotnet-sonarscanner begin /k:"VirtualPhotonics_Vts.MonteCarlo" /o:"virtualphotonics" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.nunit.reportsPaths=TestResults/*.trx /d:sonar.cs.dotcover.reportsPaths=UnitTestCoverage.html
dotnet build Vts.MonteCarlo.sln /t:Rebuild /p:Configuration=Release
dotnet test Vts.MonteCarlo.sln -c:Release -l:"trx;LogFileName=TestResult.trx" --results-directory TestResults/
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ Vts.Benchmark/
Vts.FemModeling/
Vts.Mgrte.Console/
VtsLibrary.sln
.sonarqube/
DotCover/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ _THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPL
## Copyright
Virtual Tissue Simulator (VTS) Project.

Copyright ©2022 [Virtual Photonics Technology Initiative](https://virtualphotonics.org/).
Copyright ©2023 [Virtual Photonics Technology Initiative](https://virtualphotonics.org/).
7 changes: 7 additions & 0 deletions SonarCloudAnalysis.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#We have to rerun the coverage results and export to HTML to get the coverage percentage
#Run the coverage results in Visual Studio and export the snapshot TestResultCoverage.html
dotnet sonarscanner begin -k:"Vts.MonteCarlo" /o:"lmalenfant" /d:sonar.host.url=https://sonarcloud.io /d:sonar.login="464ae516e59fb7c8f6add06984f1f9e8b711d5ce" /d:sonar.c.file.suffixes=- /d:sonar.cpp.file.suffixes=- /d:sonar.objc.file.suffixes=- /d:sonar.cs.nunit.reportsPaths=TestResult.trx /d:sonar.cs.dotcover.reportsPaths=TestResultCoverage.html
dotnet build $PWD\Vts.MonteCarlo.sln /t:Rebuild /p:Configuration=Release
dotnet test $PWD\Vts.MonteCarlo.sln -c:Release -l:"trx;LogFileName=TestResult.trx"
dotnet sonarscanner end /d:sonar.login="464ae516e59fb7c8f6add06984f1f9e8b711d5ce"
Read-Host -Prompt "Press Enter to exit"
31 changes: 31 additions & 0 deletions UnitTestCoverage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html class="main">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>UnitTestCoverage</title>

<script type="text/javascript" src="UnitTestCoverage/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="UnitTestCoverage/js/jquery.ui.custom-1.8.7.min.js"></script>
<script type="text/javascript" src="UnitTestCoverage/js/jquery.dynatree-1.2.4.min.js"></script>
<script type="text/javascript" src="UnitTestCoverage/js/jquery.cookie-1.3.1.min.js"></script>
<script type="text/javascript" src="UnitTestCoverage/js/jquery.splitter-1.5.1.min.js"></script>
<script type="text/javascript" src="UnitTestCoverage/js/dotcover.report.js"></script>

<link rel="stylesheet" type="text/css" href="UnitTestCoverage/css/dotcover.report.css">
<link rel="stylesheet" type="text/css" href="UnitTestCoverage/css/dotcover.report.gen.css">
<link rel="stylesheet" type="text/css" href="UnitTestCoverage/css/jquery.dynatree.css">
</head>

<body>
<div class="header"><span class="title">UnitTestCoverage Coverage Report</span><span class="info">Generated: Thursday, July 27, 2023 7:52:40 AM</span></div>
<div class="content" id="content"><div id="coverageTree"></div><iframe id="sourceCode"></iframe></div>
<div class="footer">JetBrains dotCover 2021.3.4 Copyright &copy; 2010-2023 <a href="http://www.jetbrains.com/dotcover/" target="_blank">Product Homepage</a> | <a href="http://www.jetbrains.com/feedback/feedback.jsp?product=dotCover&build=4&timezone=Pacific Standard Time" target="_blank">Feedback</a> | <a href="http://www.jetbrains.com/" target="_blank">Company</a></div>

<script type="text/javascript">
var resourceFolder = "UnitTestCoverage";
var blockSize = 50000;
block0 = [["Total",82,0,,,,1],["Applications",82,1,,,,2,2],["Vts.MonteCarlo.PostProcessor.Application",62,2,,,,4],["Vts.MonteCarlo.Application",92,2,,,,5],["Vts.MonteCarlo.PostProcessor",62,3,,,,6,3],["Vts.MonteCarlo.CommandLineApplication",92,3,,,,9,4],["Program",53,4,,,,13,3],["PostProcessorSetup",64,4,,,,16,4],["CommandLine",79,5,,,,20,3],["Program",87,4,,,,23,6],["ParameterSweep",100,4,,,,29,6],["CommandLine",100,5,,,,35,3],["MonteCarloSetup",100,4,,,,38,7],["ShowHelp():void",0,6,18,166,9],["Main(string[]):int",60,7,18,81,9,45,8],["GenerateDefaultInputFiles():void",100,6,18,154,9],["RunPostProcessors(IEnumerable&lt;PostProcessorInput&gt;,string,string):void",0,7,17,235,9,53,2],["ReadPostProcessorInputFromFile(string):PostProcessorInput",42,7,17,19,9],["RunPostProcessor(PostProcessorInput,string,string):void",70,7,17,67,9,55,11],["ValidatePostProcessorInput(PostProcessorInput,string):ValidationResult",100,7,17,58,9],["Switch",73,8,,,,66,6],["Process(string[],Action,params Switch[]):void",90,7,18,53,9,72,5],["CommandLine()",100,9,18,44,9],["GenerateDefaultInputFiles():void",75,6,14,223,9],["Main(string[]):int",80,7,14,37,9,77,17],["GetVersionNumber(uint):string",90,10,14,365,9],["Program()",100,9,14,27,9],["ShowHelp():void",100,6,14,242,9],["ShowHelp(string):void",100,6,14,290,9],["Name:string",100,11,,,,94,2],["Range:DoubleRange",100,11,,,,96,2],["Values:double[]",100,11,,,,98,2],["ParameterSweep()",100,12,13,30,15],["ParameterSweep(string,double[])",100,12,13,23,9],["ParameterSweep(string,DoubleRange)",100,12,13,12,9],["CommandLine()",100,9,11,39,5],["Process(string[],Action,params Switch[]):void",100,7,11,48,5,100,5],["Switch",100,8,,,,105,6],["MonteCarloSetup()",100,9,12,17,9],["ValidateSimulationInput(SimulationInput):ValidationResult",100,7,12,151,9],["RunSimulations(IEnumerable&lt;SimulationInput&gt;,string,int):void",100,7,12,199,9,111,2],["ApplyParameterSweeps(SimulationInput,IEnumerable&lt;ParameterSweep&gt;):IEnumerable&lt;SimulationInput&gt;",100,7,12,137,9],["ReadSimulationInputFromFile(string):SimulationInput",100,7,12,23,9],["RunSimulation(SimulationInput,string,int):void",100,7,12,156,9],["CreateParameterSweep(string[],ParameterSweepType):ParameterSweep",100,7,12,56,9,113,4],["(IEnumerable&lt;string&gt;):void",0,13,18,98,17],["(IEnumerable&lt;string&gt;):void",0,13,18,118,17],["():void",0,13,18,91,17],["own coverage",67,14,18,81,9],["(IEnumerable&lt;string&gt;):void",100,13,18,103,17],["(IEnumerable&lt;string&gt;):void",100,13,18,108,17],["(IEnumerable&lt;string&gt;):void",100,13,18,113,17],["(IEnumerable&lt;string&gt;):void",100,13,18,123,17],["(PostProcessorInput,ParallelLoopState,long):void",0,13,17,238,13],["own coverage",0,14,17,235,9],["(IDetectorInput):bool",0,13,17,149,31],["(IDetectorInput):bool",0,13,17,193,31],["own coverage",69,14,17,67,9],["(IDetectorInput):bool",100,13,17,102,52],["(IDetectorInput):bool",100,13,17,105,35],["(IDetectorInput):bool",100,13,17,124,52],["(IDetectorInput):bool",100,13,17,127,31],["(IDetectorInput):bool",100,13,17,146,52],["(IDetectorInput):bool",100,13,17,168,52],["(IDetectorInput):bool",100,13,17,171,31],["(IDetectorInput):bool",100,13,17,190,52],["Switch(string,string,Action&lt;IEnumerable&lt;string&gt;&gt;)",0,12,18,17,13],["Name:string",100,11,,,,117,2],["ShortForm:string",100,11,,,,119,2],["Handler:Action&lt;IEnumerable&lt;string&gt;&gt;",100,11,,,,121,2],["InvokeHandler(string[]):int",100,15,18,36,13],["Switch(string,Action&lt;IEnumerable&lt;string&gt;&gt;)",100,12,18,24,13],["own coverage",75,14,18,53,9],["({{string,Match},Switch}):bool",100,13,18,62,24],["({{string,Match},Switch}):int",100,13,18,65,25],["(string,Match):{string,Match}",100,13,18,60,18,123,2],["({string,Match},Switch):{{string,Match},Switch}",100,13,18,61,18,125,2],["():string",0,13,14,183,43],["():string",0,13,14,210,25],["(IEnumerable&lt;string&gt;):void",50,13,14,93,16,127,4],["(IEnumerable&lt;string&gt;):void",78,13,14,113,16,131,2],["(IEnumerable&lt;string&gt;):void",78,13,14,121,16,133,2],["(IEnumerable&lt;string&gt;):void",78,13,14,129,17,135,2],["(IEnumerable&lt;string&gt;):void",80,13,14,83,16,137,2],["own coverage",80,14,14,37,9],["(IEnumerable&lt;string&gt;):void",91,13,14,75,16,139,2],["(string):SimulationInput",100,13,14,168,57],["(SimulationInput):bool",100,13,14,175,55],["(IEnumerable&lt;string&gt;):void",100,13,14,65,16],["():void",100,13,14,50,16],["(IEnumerable&lt;string&gt;):void",100,13,14,70,16,141,2],["(IEnumerable&lt;string&gt;):void",100,13,14,88,16,143,2],["(IEnumerable&lt;string&gt;):void",100,13,14,56,16],["(SimulationInput):bool",100,13,14,140,21],["get",100,16,13,7,30],["set",100,17,13,7,35],["get",100,16,13,8,36],["set",100,17,13,8,41],["get",100,16,13,10,34],["set",100,17,13,10,39],["({{string,Match},Switch}):bool",100,13,11,57,23],["({{string,Match},Switch}):int",100,13,11,60,24],["(string,Match):{string,Match}",100,13,11,55,17,145,2],["({string,Match},Switch):{{string,Match},Switch}",100,13,11,56,17,147,2],["own coverage",100,14,11,48,5],["Name:string",100,11,,,,149,2],["ShortForm:string",100,11,,,,151,2],["Handler:Action&lt;IEnumerable&lt;string&gt;&gt;",100,11,,,,153,2],["InvokeHandler(string[]):int",100,15,11,31,9],["Switch(string,string,Action&lt;IEnumerable&lt;string&gt;&gt;)",100,12,11,12,9],["Switch(string,Action&lt;IEnumerable&lt;string&gt;&gt;)",100,12,11,19,9],["(SimulationInput,ParallelLoopState,long):void",100,13,12,202,13],["own coverage",100,14,12,199,9],["():string",100,13,12,74,39],["():string",100,13,12,89,39],["():string",100,13,12,131,36],["own coverage",100,14,12,56,9],["get",100,16,18,31,34],["set",100,18,18,31,39],["get",100,16,18,32,39],["set",100,18,18,32,44],["get",100,16,18,33,58],["set",100,18,18,33,63],["(string):IEnumerable&lt;Match&gt;",100,13,18,60,38],["own coverage",100,19,18,60,18],["({string,Match}):IEnumerable&lt;Switch&gt;",100,13,18,61,28],["own coverage",100,19,18,61,18],["():string",0,13,14,98,43],["():string",0,13,14,104,47],["():string",0,13,14,108,47],["own coverage",59,19,14,93,16],["():string",0,13,14,118,38],["own coverage",88,19,14,113,16],["():string",0,13,14,126,38],["own coverage",88,19,14,121,16],["():string",0,13,14,134,39],["own coverage",88,19,14,129,17],["():string",0,13,14,85,38],["own coverage",100,19,14,83,16],["():string",0,13,14,79,42],["own coverage",100,19,14,75,16],["():string",100,13,14,72,38],["own coverage",100,19,14,70,16],["():string",100,13,14,90,38],["own coverage",100,19,14,88,16],["(string):IEnumerable&lt;Match&gt;",100,13,11,55,37],["own coverage",100,19,11,55,17],["({string,Match}):IEnumerable&lt;Switch&gt;",100,13,11,56,27],["own coverage",100,19,11,56,17],["get",100,16,11,26,30],["set",100,18,11,26,35],["get",100,16,11,27,35],["set",100,18,11,27,40],["get",100,16,11,28,54],["set",100,18,11,28,59]];
coverageData = [block0];
</script>
</body>
</html>
183 changes: 183 additions & 0 deletions UnitTestCoverage/css/dotcover.report.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
html
{
height: 100%;
margin: 0;
padding: 0 6px;
font-family: verdana, helvetica, arial, sans-serif;
font-size: 11px;
color: #333333;
}

html.main
{
background-color: #d7dbde;
background-image: linear-gradient(#f1f3f4 0px, #d7dbde 45px);
}

body
{
margin: 0;
padding: 0;
}

html.main body
{
height: 100%;
}

div.header
{
background-image: url("../images/dotcover-icon.svg");
background-repeat: no-repeat;
background-position: 1px 3px;

height: 45px;
width: 100%;
vertical-align: middle;
padding-top: 10px;
}

div.header span.title
{
display: block;
font-size: 15px;
font-weight: bold;
color: #2f2f2f;
margin-left: 60px;
}

div.header span.info
{
margin-left: 60px;
}

div.content
{
height: 100%;
width: 100%;
background: white;
}

div.content ul.dynatree-container
{
height: 100%;
padding: 0;
background: #F2F4F8;
}

div.footer
{
height: 15px;
width: 100%;
text-align: center;
padding-top: 1px;
}

.vsplitbar
{
width: 6px;
background: #d7dbde;
}

.vsplitbar.active
{
background: #bbbbbb;
opacity: 0.7;
}

.vsplitbarmask
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 20000;
}

span.p
{
display: inline-block;
width: 40px;
height: 13px;
border: 1px solid black;
background-image: url("../images/percentbar-background.svg");
margin-left: 3px;
margin-right: 3px;
text-align: center;
vertical-align: middle;
font-family: tahoma, arial, helvetica;
font-size: 10px;
}

span.i
{
display: inline-block;
width: 16px;
height: 16px;
border: 0;
background-image: url("../images/metadata-icons.svg");
margin-left: 1px;
margin-right: 1px;
}

div.footer a
{
color: #0066cc;
border: none;
}

span.dynatree-active a
{
background-color: #f2f4f8;
}

ul.dynatree-container a.n
{
vertical-align: middle;
}

ul.dynatree-container a.nws
{
vertical-align: middle;
text-decoration: underline;
color: #0066cc;
}

ul.dynatree-container span.dynatree-connector
{
background-image: none;
}

iframe
{
background: white;
border: 0;
overflow: auto;
}

html.no-source body
{
height: 100%;
}

html.no-source table
{
width: 100%;
height: 100%;
text-align: center;
vertical-align: middle;
background-color: white;
}

pre.source-code
{
width: 100%;
font-family: monospace;
font-size: 14px;
margin: 0;
}

a.covered { background-color: #e3fbc9; }
a.uncovered { background-color: #ffbebe; }
122 changes: 122 additions & 0 deletions UnitTestCoverage/css/dotcover.report.gen.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
span.p0 { background-position: 0px 0; }
span.p1 { background-position: 1px 0; }
span.p2 { background-position: 1px 0; }
span.p3 { background-position: 1px 0; }
span.p4 { background-position: 1px 0; }
span.p5 { background-position: 2px 0; }
span.p6 { background-position: 2px 0; }
span.p7 { background-position: 2px 0; }
span.p8 { background-position: 3px 0; }
span.p9 { background-position: 3px 0; }
span.p10 { background-position: 4px 0; }
span.p11 { background-position: 4px 0; }
span.p12 { background-position: 4px 0; }
span.p13 { background-position: 5px 0; }
span.p14 { background-position: 5px 0; }
span.p15 { background-position: 6px 0; }
span.p16 { background-position: 6px 0; }
span.p17 { background-position: 6px 0; }
span.p18 { background-position: 7px 0; }
span.p19 { background-position: 7px 0; }
span.p20 { background-position: 8px 0; }
span.p21 { background-position: 8px 0; }
span.p22 { background-position: 8px 0; }
span.p23 { background-position: 9px 0; }
span.p24 { background-position: 9px 0; }
span.p25 { background-position: 10px 0; }
span.p26 { background-position: 10px 0; }
span.p27 { background-position: 10px 0; }
span.p28 { background-position: 11px 0; }
span.p29 { background-position: 11px 0; }
span.p30 { background-position: 12px 0; }
span.p31 { background-position: 12px 0; }
span.p32 { background-position: 12px 0; }
span.p33 { background-position: 13px 0; }
span.p34 { background-position: 13px 0; }
span.p35 { background-position: 14px 0; }
span.p36 { background-position: 14px 0; }
span.p37 { background-position: 14px 0; }
span.p38 { background-position: 15px 0; }
span.p39 { background-position: 15px 0; }
span.p40 { background-position: 16px 0; }
span.p41 { background-position: 16px 0; }
span.p42 { background-position: 16px 0; }
span.p43 { background-position: 17px 0; }
span.p44 { background-position: 17px 0; }
span.p45 { background-position: 18px 0; }
span.p46 { background-position: 18px 0; }
span.p47 { background-position: 18px 0; }
span.p48 { background-position: 19px 0; }
span.p49 { background-position: 19px 0; }
span.p50 { background-position: 20px 0; }
span.p51 { background-position: 20px 0; }
span.p52 { background-position: 20px 0; }
span.p53 { background-position: 21px 0; }
span.p54 { background-position: 21px 0; }
span.p55 { background-position: 22px 0; }
span.p56 { background-position: 22px 0; }
span.p57 { background-position: 22px 0; }
span.p58 { background-position: 23px 0; }
span.p59 { background-position: 23px 0; }
span.p60 { background-position: 24px 0; }
span.p61 { background-position: 24px 0; }
span.p62 { background-position: 24px 0; }
span.p63 { background-position: 25px 0; }
span.p64 { background-position: 25px 0; }
span.p65 { background-position: 26px 0; }
span.p66 { background-position: 26px 0; }
span.p67 { background-position: 26px 0; }
span.p68 { background-position: 27px 0; }
span.p69 { background-position: 27px 0; }
span.p70 { background-position: 28px 0; }
span.p71 { background-position: 28px 0; }
span.p72 { background-position: 28px 0; }
span.p73 { background-position: 29px 0; }
span.p74 { background-position: 29px 0; }
span.p75 { background-position: 30px 0; }
span.p76 { background-position: 30px 0; }
span.p77 { background-position: 30px 0; }
span.p78 { background-position: 31px 0; }
span.p79 { background-position: 31px 0; }
span.p80 { background-position: 32px 0; }
span.p81 { background-position: 32px 0; }
span.p82 { background-position: 32px 0; }
span.p83 { background-position: 33px 0; }
span.p84 { background-position: 33px 0; }
span.p85 { background-position: 34px 0; }
span.p86 { background-position: 34px 0; }
span.p87 { background-position: 34px 0; }
span.p88 { background-position: 35px 0; }
span.p89 { background-position: 35px 0; }
span.p90 { background-position: 36px 0; }
span.p91 { background-position: 36px 0; }
span.p92 { background-position: 36px 0; }
span.p93 { background-position: 37px 0; }
span.p94 { background-position: 37px 0; }
span.p95 { background-position: 38px 0; }
span.p96 { background-position: 38px 0; }
span.p97 { background-position: 38px 0; }
span.p98 { background-position: 39px 0; }
span.p99 { background-position: 39px 0; }
span.p100 { background-position: 40px 0; }

span.i0 { background-position: 0 0; }
span.i1 { background-position: -18px 0; }
span.i2 { background-position: -36px 0; }
span.i3 { background-position: -54px 0; }
span.i4 { background-position: -72px 0; }
span.i5 { background-position: -90px 0; }
span.i6 { background-position: -108px 0; }
span.i7 { background-position: -126px 0; }
span.i8 { background-position: -144px 0; }
span.i9 { background-position: -162px 0; }
span.i10 { background-position: 0 -18px; }
span.i11 { background-position: -18px -18px; }
span.i12 { background-position: -36px -18px; }
span.i13 { background-position: -54px -18px; }
span.i14 { background-position: -72px -18px; }
span.i15 { background-position: -90px -18px; }
span.i16 { background-position: -108px -18px; }
span.i17 { background-position: -126px -18px; }
span.i18 { background-position: -144px -18px; }
span.i19 { background-position: -162px -18px; }
Loading

0 comments on commit a75c025

Please sign in to comment.