Test Coverage Enhancement Plan
This page tracks the current incremental test-coverage plan, ordered by impact and risk.
Goals
- Increase line and branch coverage without broad refactors.
- Prioritize high-reuse private helpers before adding many public wrappers.
- Keep tests deterministic and cross-platform safe.
Current Priority Order
- Private request and error helpers
- Public cmdlet endpoint/resource mapping tests
- Low-risk class constructor/property coverage
- Broader folder-by-folder public coverage expansion
Batch 1 (Started)
Focus:
New-NinjaOnePOSTRequestNew-NinjaOneErrorGet-NinjaOneUsers
Implemented in this batch:
- Added additional
New-NinjaOnePOSTRequesttests for endpoint preflight behavior. - Added
Get-NinjaOneUserstests for default/organisation resource routing and no-result error delegation.
Next Batches
Batch 2
Targets:
Source/Private/New-NinjaOneQuery.ps1Source/Private/Get-NinjaOneSecrets.ps1
Test themes:
- query-string composition edge cases
- secret fallback and incomplete secret set handling
Batch 3
Targets:
Source/Public/System/Get/Get-NinjaOneAlerts.ps1Source/Public/System/Get/Get-NinjaOneJobs.ps1Source/Public/Queries/Get/Get-NinjaOneSoftwareInventory.ps1
Test themes:
- resource selection
- query propagation
- null/empty result handling through
New-NinjaOneError
Batch 4
Targets:
Source/Classes/06-NinjaOneTicketBoardSort.Object.Class.ps1
Test themes:
- constructor defaults
- expected property mapping
Validation Workflow Per Batch
Run these checks after each test batch:
pwsh -File .\DevOps\Quality\test.ps1 -Suite private,public -skipScriptAnalyzer
pwsh -File .\DevOps\Quality\run-pssa.ps1
Then review updated coverage artifacts under .artifacts:
CodeCoverage.private.xmlCodeCoverage.public.xml
Notes
- Prefer deterministic mocks over network/listener behavior in private tests.
- Add behavior assertions (resource path, query/body shape, error delegation) before adding broad existence-only tests.