Skip to content

Improve test coverage for JsonElement (when backed by JsonNode) for edge cases around enumeration #30866

@ahsonkhan

Description

@ahsonkhan

We can improve test coverage of certain branches within JsonElement (when it's backed by JsonNode):

Metric Value
Covered lines: 629
Uncovered lines: 13
Coverable lines: 642
Total lines: 2096
Line coverage: 97.9% (629 of 642)
Covered branches: 213
Total branches: 225
Branch coverage: 94.6% (213 of 225)

Edge cases while enumerating JSON objects and JSON arrays. It's possible these branches are unreachable:
https://github.com/dotnet/corefx/blob/e8efb815275c8323fedc950ca3596474fa5e23c3/src/System.Text.Json/src/System/Text/Json/Document/JsonElement.ArrayEnumerator.cs#L51-L59
image

https://github.com/dotnet/corefx/blob/e8efb815275c8323fedc950ca3596474fa5e23c3/src/System.Text.Json/src/System/Text/Json/Document/JsonElement.ObjectEnumerator.cs#L47-L55
image

These tests won't fail on .NET Core (and they are likely already covered by tests that run on netfx, but it would be good to verify).
https://github.com/dotnet/corefx/blob/e8efb815275c8323fedc950ca3596474fa5e23c3/src/System.Text.Json/src/System/Text/Json/Document/JsonElement.cs#L1097-L1105
image

https://github.com/dotnet/corefx/blob/e8efb815275c8323fedc950ca3596474fa5e23c3/src/System.Text.Json/src/System/Text/Json/Document/JsonElement.cs#L1176-L1184
image

cc @kasiabulat

Metadata

Metadata

Assignees

Labels

area-System.Text.Jsonbacklog-cleanup-candidateAn inactive issue that has been marked for automated closure.good first issueIssue should be easy to implement, good for first-time contributorstest-enhancementImprovements of test source code

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions