Skip to content

Add test coverage to CI #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
711156d
Add unit test skeleton
networkfusion Apr 12, 2022
25b52c2
Update build image
networkfusion Apr 12, 2022
eef6f8f
Build image concurency.
networkfusion Apr 12, 2022
e34bc9a
Add Code Coverage
networkfusion Apr 12, 2022
a8b2dff
Correct variable name
networkfusion Apr 12, 2022
ebae9fa
Merge branch 'add-unittest-skeleton' into add-test-code-coverage
networkfusion Apr 12, 2022
ebaf549
Correct name
networkfusion Apr 14, 2022
1b3c67a
Merge branch 'add-test-code-coverage' of https://github.com/nanoframe…
networkfusion Apr 14, 2022
877643d
Update image version
networkfusion Apr 14, 2022
daf229a
Merge branch 'add-unittest-skeleton' into add-test-code-coverage
networkfusion Apr 14, 2022
dc1420a
Merge branch 'add-test-code-coverage' of https://github.com/nanoframe…
networkfusion Apr 14, 2022
4e13f85
Fix multiple file warning.
networkfusion Jul 12, 2022
3a443a0
Fix the fix
networkfusion Jul 12, 2022
5233ebf
Continue on test error
networkfusion Jul 12, 2022
a4b5885
Fix yaml
networkfusion Jul 12, 2022
d4f70bc
Further fix to yaml
networkfusion Jul 12, 2022
16889bd
Use wrap option
networkfusion Jul 12, 2022
062c81a
Fix location of coverage report
networkfusion Jul 12, 2022
6f3c156
Fail on test fail
networkfusion Jul 12, 2022
9afdfbb
Merge branch 'main' into add-test-code-coverage
networkfusion Dec 19, 2022
bbd1205
Update CloudsmithApiTests.cs
networkfusion Dec 19, 2022
768efc2
Update FirmwarePackageTests.cs
networkfusion Dec 19, 2022
223a168
Improve CI task name
networkfusion Dec 19, 2022
41ba0a3
Update CloudsmithApiTests.cs
networkfusion Dec 19, 2022
45b9c70
Merge branch 'main' into add-test-code-coverage
networkfusion Apr 20, 2023
c886de9
Merge branch 'main' into add-test-code-coverage
networkfusion Jun 1, 2023
e116b8f
Merge branch 'main' into add-test-code-coverage
networkfusion Aug 23, 2023
fa19eef
Merge branch 'main' into add-test-code-coverage
networkfusion Jan 4, 2024
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
24 changes: 21 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
##############################
- job: Check_Build_Options
pool:
vmImage: 'windows-latest'
vmImage: 'windows-2022'

steps:

Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
- Check_Build_Options

pool:
vmImage: 'windows-2019'
vmImage: 'windows-2022'

variables:
DOTNET_NOLOGO: true
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
# only required when updating dependents
- script: nbgv cloud -a -c
condition: eq(variables['UPDATE_DEPENDENTS'], 'true')
displayName: Set Could Version
displayName: Set nbgv Cloud Version

- task: DotNetCoreCLI@2
displayName: Restore NuGet packages
Expand All @@ -217,6 +217,24 @@ jobs:
displayName: Build NuGet package
condition: eq(variables['UPDATE_DEPENDENTS'], 'false')

##################################################

- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: |
./nanoFirmwareFlasher.Tests/nanoFirmwareFlasher.Tests.csproj
arguments: '--configuration $(BuildConfiguration) --collect "XPlat Code coverage"'

- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'

##################################################

- script: dotnet pack --runtime win-x64 -c $(BuildConfiguration) -p:PublicRelease=true -p:PackGlobalTool=true --no-restore
displayName: Build .NET Core Tool NuGet package
condition: eq(variables['UPDATE_DEPENDENTS'], 'false')
Expand Down
33 changes: 33 additions & 0 deletions nanoFirmwareFlasher.Tests/CloudsmithApiTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace nanoFirmwareFlasher.Tests
{
[TestClass]
public class CloudsmithApiTests
{
[TestMethod]
public void CheckApiUriExists()
{
Assert.IsTrue(false);
}

[TestMethod]
public void CheckApiVersionExists()
{
// And is not deprecated?!
Assert.IsTrue(false);
}

[TestMethod]
public void DecodePackageDetails()
{
Assert.IsTrue(false);
}

[TestMethod]
public void DecodePackageInformation()
{
Assert.IsTrue(false);
}
}
}
33 changes: 33 additions & 0 deletions nanoFirmwareFlasher.Tests/FirmwarePackageTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace nanoFirmwareFlasher.Tests
{
[TestClass]
public class FirmwarePackageTests
{

[TestMethod]
public void ListReferenceTargets()
{
Assert.IsTrue(false);
}

[TestMethod]
public void ListCommunityTargets()
{
Assert.IsTrue(false);
}

[TestMethod]
public void DownloadReferenceTarget()
{
Assert.IsTrue(false);
}

[TestMethod]
public void DownloadCommunityTarget()
{
Assert.IsTrue(false);
}
}
}
17 changes: 17 additions & 0 deletions nanoFirmwareFlasher.Tests/nanoFirmwareFlasher.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
<PackageReference Include="coverlet.collector" Version="3.1.0" />
</ItemGroup>

</Project>
20 changes: 20 additions & 0 deletions nanoFirmwareFlasher.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,40 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
version.json = version.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nanoFirmwareFlasher.Tests", "nanoFirmwareFlasher.Tests\nanoFirmwareFlasher.Tests.csproj", "{CF76CB85-81C8-40AF-B252-84A8B43F13BA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Debug|x64.ActiveCfg = Debug|x64
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Debug|x64.Build.0 = Debug|x64
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Debug|x86.ActiveCfg = Debug|x64
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Release|Any CPU.Build.0 = Release|Any CPU
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Release|x64.ActiveCfg = Release|x64
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Release|x64.Build.0 = Release|x64
{762BA2A1-B3E9-4E26-9491-AE11D1F1C1EA}.Release|x86.ActiveCfg = Release|x64
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Debug|x64.ActiveCfg = Debug|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Debug|x64.Build.0 = Debug|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Debug|x86.ActiveCfg = Debug|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Debug|x86.Build.0 = Debug|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Release|Any CPU.Build.0 = Release|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Release|x64.ActiveCfg = Release|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Release|x64.Build.0 = Release|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Release|x86.ActiveCfg = Release|Any CPU
{CF76CB85-81C8-40AF-B252-84A8B43F13BA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down