test(integration): raise integration coverage above 80% - #300
Merged
Conversation
Add integration tests covering the conditional Append/AppendLine API (AppendIf/AppendLineIf), pointer/memory/span Append overloads, the full AppendXmlDoc* documentation helpers, AppendFormat/AppendLineFormat overloads, interpolated string handling, and nested Scope/ScopeLine usage. Line coverage for the integration suite rises from ~21% to ~88%, branch coverage from ~22% to ~84%, bringing the combined unit + integration coverage to ~94% line / ~91% branch.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #300 +/- ##
==========================================
+ Coverage 85.00% 91.76% +6.76%
==========================================
Files 15 15
Lines 340 340
Branches 100 100
==========================================
+ Hits 289 312 +23
+ Misses 33 17 -16
+ Partials 18 11 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The integration test project only covered about 21% of lines / 22% of branches, well below the target of >80%. The unit test suite was already well above target, but the combined coverage requirement (>90%) was also at risk because of the integration project's low numbers.
Changes
Added integration tests that exercise the previously untested parts of the public API through realistic code-generation scenarios:
CSharpCodeBuilderTests.ConditionalApi.cs— everyAppendIf/AppendLineIfoverload, both the true and false branch, including the pointer-based overloadCSharpCodeBuilderTests.AppendVariants.cs—char[],ReadOnlyMemory<char>,ReadOnlySpan<char>, and pointer-basedAppendsources, plus special-character handling ({,},\n,\0)CSharpCodeBuilderTests.DocumentationApi.cs— the fullAppendXmlDoc*family, including null/empty inputsCSharpCodeBuilderTests.FormatAndInterpolationApi.cs— allAppendFormat/AppendLineFormatoverloads and theAppendInterpolated/AppendLineInterpolatedinterpolated string handlerCSharpCodeBuilderTests.ScopeAndCapacityApi.cs— nestedScope()/ScopeLine()usage,Clear(),Indent()/Intend(),EnsureCapacity()Coverage (measured locally)
All targets (>80% unit, >80% integration, >90% combined) are met.
Testing
dotnet test— 395 unit tests and 27 integration tests, all passingMicrosoft.Testing.Extensions.CodeCoverage(cobertura) and merged withreportgenerator